Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-15-2008, 11:23 AM   #16
Senior Member
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 9 Stretch
Posts: 2,174
Blog Entries: 8

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340

For relatively simple bulk renaming, I like to use a utility called mmv.

For example, to rename something like "EM76540.pdf" to "76540EM.pdf", you could use a command like:

mmv "EM*.pdf" "#1EM.pdf"

In the first argument, you can use "*" and "?" like traditional wildcards. In the second argument, you use "#1", "#2", "#3", and so on to specify the things matched by the wildcards. #1 refers to whatever matched the first wildcard (in this example, the only one).
Old 06-20-2009, 11:16 AM   #17
LQ Newbie
Registered: Feb 2005
Posts: 10

Rep: Reputation: 0
rename command is best way

Check out the rename command with man rename.

It will do this. The documentation is simple and it works on multiple files. The "from" and "to" apply to text existing in the filenames and the "file" applies to the files you want to effect.

This way you don't have to write scripts. The processing time is negligable in either case, but rename is always there.

rename will also traverse folders. I had a problem with about 20,000 files which folders and file names that contained spaces and apostrophe's. With rename I fixed them all as fast as I could type.

For example:

rename ' ' '' */*

Replaced the first space char in all file and folder names. I ran it a few times and all the spaces were gone.

rename "'" '' */*

Replaced all of the apostrophe chars (max was 1 per fn or folder)


Last edited by umina; 06-20-2009 at 11:23 AM.


files, mv, rename

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
assigning a large float number in E notation edM Programming 3 05-09-2005 12:51 PM
Deleting a large number of files msteudel Linux - General 4 01-26-2005 01:36 AM
Large Number of files? mikeshn Linux - Security 2 01-10-2004 06:11 AM
Java: Compile Large number of source files ? mikeshn Programming 7 10-07-2003 11:33 AM
Large number of open ports RefriedBean Linux - Security 3 07-05-2002 11:34 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration