How to Rename Multiple Files with FileZilla Pro CLI

Rename multiple files

To rename multiple files, use the mrn (or mren) command for remote files and mlrn (or mlren) for local files

    mrn options [pattern]
    lmr options [pattern]

pattern: optional regular expression to select which entries to rename. If missing, all entries in the current directory are renamed. See Regular Expressions to learn more about regular expression syntax.

Options:

To replace text in file names you have the following options:

  • --search, -s: the text to be searched.
  • --replace, -r: the text that will replace the searched text.
  • --case, -c: match case in searched text
  • --regex, -x: uses search text as a regular expression.

The options to add text in file names are:

  • --add, -a: the text that will be added to the beginning of the file name.
  • --end, -e: the text that will be added to the end of the file name.

Common options:

  • --exists, e: how to handle existing entries:
    • – ignore, i: new name is ignored, rename doesn’t take place
    • overwrite, o: existing entry is replaced. If you try to rename two or more entries with the same new name FileZilla Pro CLI returns an error and aborts the operation.
    • number, n: an incremental number is added to the new name

Examples

  • Replace IMG by DSC in all JPEG files:
    mrn --search IMG --replace DSC --exist number \.jpg$
  • Rename .docx files to .bak:
    lmrn --regex --search \.docx$ --replace .bak --exists ignore
  • Add tmp to the beginning of all files in the current directory:
    mrn --add tmp --exists ignore
  • Remove the tmp from the beginning:
    mrn --regex --search ^tmp --exists ignore

The video tutorial below shows how to use the commands to rename multiple files with FileZilla Pro CLI.

Video tutorial: How to Rename Multiple Files with FileZilla Pro CLI

Tags: , ,