diff options
Diffstat (limited to 'doc/fd.1')
-rw-r--r-- | doc/fd.1 | 80 |
1 files changed, 44 insertions, 36 deletions
@@ -156,9 +156,20 @@ can be used as an alias. Enable the display of filesystem errors for situations such as insufficient permissions or dead symlinks. .TP -.B \-\-strip-cwd-prefix -By default, relative paths are prefixed with './' when the output goes to a non interactive terminal -(TTY). Use this flag to disable this behaviour. +.B \-\-strip-cwd-prefix [when] +By default, relative paths are prefixed with './' when -x/--exec, +-X/--exec-batch, or -0/--print0 are given, to reduce the risk of a +path starting with '-' being treated as a command line option. Use +this flag to change this behavior. If this flag is used without a value, +it is equivalent to passing "always". Possible values are: +.RS +.IP never +Never strip the ./ at the beginning of paths +.IP always +Always strip the ./ at the beginning of paths +.IP auto +Only strip if used with --exec, --exec-batch, or --print0. That is, it resets to the default behavior. +.RE .TP .B \-\-one\-file\-system, \-\-mount, \-\-xdev By default, fd will traverse the file system tree as far as other options dictate. With this flag, fd ensures that it does not descend into a different file system than the one it started in. Comparable to the -mount or -xdev filters of find(1). @@ -364,6 +375,30 @@ Set the path separator to use when printing file paths. The default is the OS-sp Provide paths to search as an alternative to the positional \fIpath\fR argument. Changes the usage to \'fd [FLAGS/OPTIONS] \-\-search\-path PATH \-\-search\-path PATH2 [PATTERN]\' .TP +.BI "\-\-format " fmt +Specify a template string that is used for printing a line for each file found. + +The following placeholders are substituted into the string for each file before printing: +.RS +.IP {} +path (of the current search result) +.IP {/} +basename +.IP {//} +parent directory +.IP {.} +path without file extension +.IP {/.} +basename without file extension +.IP {{ +literal '{' (an escape sequence) +.IP }} +literal '}' (an escape sequence) +.P +Notice that you can use "{{" and "}}" to escape "{" and "}" respectively, which is especially +useful if you need to include the literal text of one of the above placeholders. +.RE +.TP .BI "\-x, \-\-exec " command .RS Execute @@ -384,29 +419,12 @@ If parallelism is enabled, the order commands will be executed in is non-determi --threads=1, the order is determined by the operating system and may not be what you expect. Thus, it is recommended that you don't rely on any ordering of the results. -The following placeholders are substituted before the command is executed: -.RS -.IP {} -path (of the current search result) -.IP {/} -basename -.IP {//} -parent directory -.IP {.} -path without file extension -.IP {/.} -basename without file extension -.IP {{ -literal '{' (an escape sequence) -.IP }} -literal '}' (an escape sequence) -.RE +Before executing the command, any placeholder patterns in the command are replaced with the +corresponding values for the current file. The same placeholders are used as in the "\-\-format" +option. If no placeholder is present, an implicit "{}" at the end is assumed. -Notice that you can use "{{" and "}}" to escape "{" and "}" respectively, which is especially -useful if you need to include the literal text of one of the above placeholders. - Examples: - find all *.zip files and unzip them: @@ -430,19 +448,9 @@ once, with all search results as arguments. The order of the arguments is non-deterministic and should not be relied upon. -One of the following placeholders is substituted before the command is executed: -.RS -.IP {} -path (of all search results) -.IP {/} -basename -.IP {//} -parent directory -.IP {.} -path without file extension -.IP {/.} -basename without file extension -.RE +This uses the same placeholders as "\-\-format" and "\-\-exec", but instead of expanding +once per command invocation each argument containing a placeholder is expanding for every +file in a batch and passed as separate arguments. If no placeholder is present, an implicit "{}" at the end is assumed. |