Some people have difficulty renaming lots of files at once on the command line. I used to experience this issue a lot, especially since “mv” was the command recommended. While I can appreciate why mv makes sense for renaming, it still was not intuitive for me. The original file is, in a sense, gone. Renaming a file can be seen as making a new file.
However, there is another command, nearly as available, which can rename things quite easily. You will never guess its name. Something simple, and descriptive of the action of renaming files…: rename! It syntax is easy:
rename 'PERL REGEX' FILELIST
The FILELIST can use regex as well. So if I wanted to renamed all of my Mahler “Symphony No. 1″ files (they all started with “_- Mahler”), I would simply run this in the folder the files were in:
rename 's/^\_\-\ Mahler/Mahler/' *.mp3
Voilà! Now all my file names have been fixed in one fell swoop. An explanation of regex is not something I want or can do right now, but internet tutorials and articles on it are legion.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.









This is indeed very helpful
I am really glad that I found this kind of blog post. Before I have a problem about Rename Files I don’t know what to do. Its a little bit harder to do it. But now it is so easy to work with it. Its because i found this blog. This blog is very helpful for me.
Thanks!