![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hello - new here - bash script - need to rename and zip files. | Aixia | Shell Programming and Scripting | 1 | 07-15-2008 03:48 PM |
| simple count script outputting mass errors | aspect_p | Shell Programming and Scripting | 2 | 03-09-2008 07:58 PM |
| VI questions : mass changes, mass delete and external insert | Browser_ice | AIX | 1 | 12-13-2006 04:20 AM |
| Mass Copy/rename | lwilsonFG | UNIX for Dummies Questions & Answers | 6 | 11-03-2005 06:55 AM |
| Easy way to mass rename files? | Thermopylae | UNIX for Dummies Questions & Answers | 17 | 11-18-2002 01:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
bash script to rename in mass
Basically, I have a huge amount of files (ripped audiobooks) that all have the same garbage in their filenames. I'm wondering how to go about writing a bash script to mass rename them. Example filenames as they stand now: Code:
The First CD - 1x01 - Title 1.mp3 The First CD - 1x02 - Title 2.mp3 The First CD - 1x03 - Title 3.mp3 The First CD - 1x04 - Title 4.mp3 I'd like to have the script ask me what needs to be removed and then do it. In this case, I want to remove the text: "The First CD - " The output of the directory above would then be: Code:
1x01 - Title 1.mp3 1x02 - Title 2.mp3 1x03 - Title 3.mp3 1x04 - Title 4.mp3 Thanks all! |
|
||||
|
if you have Python , you can use this script. eg usage Code:
# ls -1 *Title*mp3 The First CD - 1x01 - Title 1.mp3 The First CD - 1x02 - Title 2.mp3 # filerenamer.py -p "The First CD - " -e "" -l "*Title*mp3" #use -l to check ==>>>> [ /home/The First CD - 1x01 - Title 1.mp3 ]==>[ /home/1x01 - Title 1.mp3 ] ==>>>> [ /home/The First CD - 1x02 - Title 2.mp3 ]==>[ /home/1x02 - Title 2.mp3 ] # filerenamer.py -p "The First CD - " -e "" "*Title*mp3" #remove -l to commit /home/The First CD - 1x01 - Title 1.mp3 is renamed to /home/1x01 - Title 1.mp3 /home/The First CD - 1x02 - Title 2.mp3 is renamed to /home/1x02 - Title 2.mp3 # ls -1 *Title*mp3 1x01 - Title 1.mp3 1x02 - Title 2.mp3 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|