Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have folder with several hundred files named like this:


I want to rearrange the file names so that last two digits are moved to the front like this:


I want to avoid writing a script.

Instead, I'm looking for a "linux gui regular expression file renamer" that can recursively evaluate all files in a folder (and its sub-folders).

I want the ability to specify a regular expression for matching a file:


And I want the ability to perform regular expression substitution to rename the file:


Any suggestion?

share|improve this question
up vote 6 down vote accepted

I realize this is not exactly a "GUI", but you didn't say anything why that is a requirement, and there are already-written command-line tools that do this; e.g. perl-rename:

find ~/dir -type f -exec prename -n 's/^(\d\d)(\d\d)(\d\d)(.*)$/$3$1$2$4/' {} +

(-n turns on "test" mode. When you're satisfied with the output, run again with -v or no options instead.)

share|improve this answer
This program isn't always named the same; in the Ubuntu repositories, it is simply called rename. Also, it can be used on every *.txt in a directory directly with prename 's/search/replace/' *.txt, though of course this won't give the recursiveness of find. – evilsoup May 5 '13 at 12:11
I marked this as the answer, even though it is not a GUI. I like how you even covered my recursive requirement (that I kind of just threw in there to make it tough). Also check out the answer I posted regarding thunar. – LonnieBest May 9 '13 at 21:52
How do you get it to output anything during testing? When I run the command you suggested it just immediately returns me to a command prompt. – LonnieBest May 10 '13 at 0:04
This worked: find -type f -exec prename -n 's/(\d\d)(\d\d)(\d\d)(.*)/$3$1$2$4/' {} + – LonnieBest May 10 '13 at 0:25

Some good GUI tools for renaming files are

  • KRename for KDE desktop environment (I personally prefer this one because I'm a KDE user);
  • GPRename and pyRenamer for Gnome.
share|improve this answer
Although these tools allow you to match by regular expression, I don't believe any of them support substitution like Thunar does. – LonnieBest May 9 '13 at 21:47

I appreciate the suggestions, but I found an easier way, using a graphical user interface.

In Ubuntu, install thunar:

sudo apt-get install thunar

Then all you have to do is navigate to a folder (with thunar) and hit ctrl-a to select all files in that folder.

After this, right-click on one of the files (you've highlighted), and select "rename" from the context menu. Then, this dialog pops up, allowing you to do regular expression substitution for renaming.

This doesn't meet the recursive requirement I mentioned, but for changing the names of all files within a single folder, its a lot simpler than the command line, but actually, I do appreciate both methods.

share|improve this answer
The only drawback to this solution is that Thunar is a full file manager rather than a simple renamer, and the chances are that by installing it you have now two file managers on your system (Thunar and the one provided by your distro, I suppose Nautilus or Dolphin); I have to be honest, it doesn't cause any problem, it's just redundant, and if you are happy with it then everyone's fine :) – Sekhemty May 9 '13 at 21:49
Well, the only time I'd use it is for this use-case (nautilus otherwise). It's worth the extra space that it redundantly takes up for this feature alone. – LonnieBest May 9 '13 at 21:57
Well, the nice part of Linux is to tailor your system to your needs, so if you like it, it's your best solution. – Sekhemty May 9 '13 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .