Rename Files on the Linux console

Aus Weis nix
Wechseln zu: Navigation, Suche

On Debian , rename is often used for tasks like this:

  • rename all .htm files to .html:
    • rename -n ’s/\.htm$/\.html/’ *.htm
    • the -n is for the testrun. After the output seems right to you , replace it with -v for the real/verbose mode.
  • rename just DSC00234.JPG to DSC00234.jpg
    • rename -n 's/DSC(\d{5})\.JPG$/DSC$1\.jpg/' *.JPG


the command uses perlexpressions.