43

I need to rename a bunch of files in order to fix their sort order, therefore I need to be able to do a sort of "find and replace" so I can replace chunks of the filenames at a time.

What tools should I use? I prefer GUI but a command line tool recommendation would also be fine.

15 Answers 15

54

There are a few but I recommend gprename Install gprename which is a good compromise between usability and functionality.

Other tools are: rename, krename Install krename , pyrenamer Install pyrenamer , cuteRenamer, ...

  • 6
    pyRenamer is not bad at all. – skalka Oct 31 '10 at 19:20
  • 6
    I have use pyrenamer often and sometimes gprename unless the change is very easily done on the command line. The best thing about these GUI's is the built-in 'preview' action. This will save you headaches. – belacqua Jan 21 '11 at 22:22
  • 4
    +1 for gprename, just tried and done the needed rename in 5 seconds – Pisu Nov 8 '13 at 6:28
  • Shame neither gprename or pyrename can take list of files to rename from the command line – artfulrobot May 17 '14 at 9:48
  • gprename is great on 14.04. Did 300 folders renaming by regex in 15 seconds – 3rgo Jan 30 '15 at 18:16
10

I really like qmv from the renameutils package. It enables you to use your favorite (terminal based) text editor to rename files. I prefer to invoke it with -f do which gives you a single column (one row per file) with filenames. Combined with the power of Vim it gives you all the tools you need to do massive filename editing.

http://www.nongnu.org/renameutils/

7

Métamorphose

https://github.com/metamorphose

may be a little difficult to handle, but really powerful!

  • I really like this one. It is quite powerful and runs on all major platforms. – daniels Sep 15 '15 at 17:26
5

If you like the shell and perl regular expressions I'd recommend rename. It's as plain as it's name.

4

thunar file manager is a GUI with a bulk rename option

http://thunar.xfce.org/pwiki/documentation/bulk_renamer

it's not standard on Gnome but can be installed through the software centre

3

If you are familiar with Emacs, I think nothing beats Dired for this task. Even if you don't use Emacs that often you may find Dired a handy tool.

sudo aptitude install emacs23-nox

Start Emacs Dired mode for a directory:

emacs -nw path/to/dir/

Now enter edit directory mode:

C-x C-q (that is Ctrl+x followed by Ctrl+q)

You can now edit the filenames like editing text in every plain text editor. You may even chose to replace the filenames using regular expressions (note that unfortunately Emacs uses a different syntax than PCRE).

For example, to rename files with counter (starting by 1):
M-x replace-regexp (that is Alt+x followed by the string "replace-regexp" typed in the minibuffer at the bottom of the screen).
Replace regexp: DSCN\([0-9]+\).JPG
Replace with: \,(format "P%04d.jpg" (1 + \#))

To reuse a counter in the filename:
M-x replace-regexp
Replace regexp: DSCN\([0-9]+\).JPG
Replace with: \,(format "P%04d.jpg" (string-to-number \1))

When finished, type:

C-c C-c (that is Ctrl+c followed by Ctrl+c)

Or alternatively press the following sequence to abort your changes:

C-c Esc (that is Ctrl+c followed by Esc)

2

I tend to use mmv, which is command-line based, and has a somewhat quirky expression syntax but tend to solve most of my problems.

1

If you use Nautilus and know how Nautilus Scripts work, you could use nautilus-renamer.

0

On the command line theres also the possibility to use magic of sed and shell:

ls *.c | sed "s#\(.*\)\.c#mv \0 \1.cpp#" | sh
  • 1
    That doesn't seem to work as printed. You might also use '#' or other character instead of "\" as separators in examples for possibly more clarity. e.g., ` ls .c | sed 's#([a-z])\.c#\1.cpp#' ` (This example is not do the rename, just to display the new filename, for simplicity) – belacqua Jan 21 '11 at 23:07
  • +1 I find it a really nice way (that additionally works across all distros), without installing anything. But I would probably use the -d switch for ls to avoid listing content of directories which might also end with .c (most of the times not an issue, but still ..). – Levite Nov 3 '14 at 8:42
0

Windows has a really good program for this called Bulk Rename Utility. Here is the URL: http://www.bulkrenameutility.co.uk/Main_Intro.php.

There is a unicode Windows 98 version that is portable. I put that in a folder on my Linux system (Mint Maya) and when I run it through Wine it works like a charm. The gui is very easy to use and very flexible.

  • I almost want to run this in wine. It's so much better than pyRenamer. – Teque5 Jul 27 '16 at 22:23
0

For me the pyRenamer worked the best. Nothing (sadly) comes close to Total Commanders built it renaming tool. pyRenamer doesn't integrate with Krusader but considering the fact, that you don't use the renaming tools that often anyway, pyRenamer is a very good option.

0

This is the tool I use: rnm (man page) (more examples)

Some Usage:

rnm file-name -ns new-filename             # single file
rnm ./* -ns '/n//i/'                       # files will be sorted and indexed.
rnm ./* -rs '/search/new/g'                # 'search' in filenames will be replaced with 'new'
rnm ./* -ns '/fn//i/' -ss 'search'         # only files/directories which contain 'search' in their name will be indexed (renamed).
rnm ./* -ns '/fn//id/' -fo                 # file only mode, directories will be ignored.
rnm ./* -ns '/fn//id/' -fo -dp -1          # recursive to subdirectories all the way.

etc...
0

Personally I use Ant Renamer with Wine because nothing I've tried (Métamorphose, PyRenamer, GPRename, KRename) is as powerful, easy to install and easy to use. And it's still FOSS so I don't see the problem.

0

Krename is a KDE GUI for renaming files, generally found in most package managers.

This answer applies to removing leading numbers that may be found in music files such as mp3s. But Krename does mass rename as well.

  1. Load selected files or folder. Krename loads all files in the selected folder, just click on Open without having to individually select all files.

  2. Go to the Destination tab to overwrite or copy files to another folder.

  3. Go to the Filename tab, then to the Advanced Filename tab.

     "Advanced Filename" image showing the default settings.

  4. Start by removing the token $ in the Template window. A change takes place in the Renamed window below. No filenames appear, only the file extensions.

    3. Image shows that the filenames have been removed, leaving the file extensions.

  5. Click on Insert Part of Filename... and select the parts of the filename you want to keep. This operation will include all the files and the changes will be obvious in the Renamed window below.

    4. "Insert Part of Filename..." image showing how to select the filename by highlighting the preferred sections.

  6. Click OK. The files are renamed without the leading numbers.

    5. Final results showing.

  7. Finally, click Finished at the bottom right corner.

0

A newer GUI batch rename utility that runs on Linux (it also works on Mac and Windows) is Inviska Rename.

enter image description here

Besides the usual rename functions like replacing a portion of the text with some other text, inserting or removing text, renaming file extensions, and so on, this tool can rename folders, rename music based on tags, and rename photos using their Exif information. It can even batch rename using file attributes like the creation or modification date.

Other features include previewing the new filenames and undoing the batch rename, which I find very useful.

Source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.