LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 07-15-2008, 11:23 AM   #16
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,349

Rep: Reputation: 49

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
umina
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)


Len
WT6G

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


Reply

Tags
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


All times are GMT -5. The time now is 05:00 AM.

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