Skip to content

Command line options

Ayooluwa Isaiah edited this page Feb 2, 2023 · 8 revisions

The main way to customize F2's behavior is to use flags and options on the command-line.

FLAGS

--csv=FILE: Rename using a CSV file

-f, --find=PATTERN: Search pattern which is treated as a regular expression by default unless --string-mode is also used. Defaults to the entire file name if omitted.

-r, --replace=STRING: Replacement string. Defaults to an empty string if omitted. Supports several kinds of variables.

-u, --undo: Undo the last renaming operation performed in the current working directory if possible.

OPTIONS

--allow-overwrites: Allow the overwriting of existing files.

-E, --exclude=PATTERN: Exclude files/directories that match the given pattern. Multiple exclude patterns can be specified by repeating this option.

-x, --exec: Commit the renaming operation to the filesystem.

-F, --fix-conflicts: Automatically fix renaming conflicts based on predefined rules.

-H, --hidden: Include hidden files in the renaming operation (they are skipped by default).

-d, --include-dir: Include directories in the renaming operation (they are exempted by default).

-i, --ignore-case: Ignore string casing when searching for matches.

-e, --ignore-ext: Ignore the file extension when searching for matches.

-m, --max-depth=INTEGER: Indicates the maximum depth for a recursive search (set to 0 by default for no limit).

--no-color: Disable coloured output.

-D, --only-dir: Rename only directories, not files (implies --include-dir).

-q, --quiet: Don't print out any information (except errors).

-R, --recursive: Recursively traverse directories when searching for matches. Use max-depth to control the maximum depth.

-l, --replace-limit=INTEGER: Limit the number of replacements to be made on each matched file (replaces all matches if set to 0 which is the default). Can be set to a negative integer to start replacing from the end of the file name.

--sort=SORT: Sort the matches in ascending order according to the provided ''. Allowed sort values:

  • default: alphabetical order.
  • size: sort by file size.
  • mtime: sort by file last modified time.
  • btime: sort by file creation time.
  • atime: sort by file last access time.
  • ctime: sort by file metadata last change time.

--sortr=SORT: Same options as --sort but presents the matches in the descending order.

-s, --string-mode: Treats the search pattern specified through --find as a non-regex string.

-V, --verbose: Enable verbose output.

-h, --help: Show help output.

-v, --version: Print the version number (and optionally check for updates).

Clone this wiki locally