massive rename of songs; normalize song filename convert foriegn to english character
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
massive rename of songs; normalize song filename convert foriegn to english character
i have about 35k songs. some of them have foregin character like (¶,ö) in their filename. and some players like clementine, gmusicbrowser wont detect these songs.
so i need help to replace those forign char into their respective english char.
I would change it a bit to work on nested folders and to test if it works for you:
Code:
find /path/to/files -type f -print | grep [ÄÖÜäöüß¶] | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); echo mv "$file" "$N"; done
The output will show the files (filenames) to be changed.
If you are satisfied with the result do:
Code:
find /path/to/files -type f -print | grep [ÄÖÜäöüß¶] | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); mv "$file" "$N"; done
You also might want to change the grep part of this command. Insert all characters you don't want to have. Be aware the characters are just deleted and not replaced.
If you also want to change names of paths remove the "-type f" option of the find command.
The command may take a long time to execute, you mentioned you have 35k songs. Just be patient.
You may also be able to do it with Thunar, the file manager used for xfce (you can use it without xfce), but you may have a lot to rename. I've used it with success for under 100 files.
Since they are music files, are you only concerned about the file names or do you also want to rectify the IDx tags?
If only file names, then the above solutions are good - however, if you're interested in fixing up the tags; I had a similar issue with around 25,000 MP3 files - I used a variety of tag editors on both Windoze and Linux (Ubuntu) clients - and I found an application called "Easy Tag" which did the trick quite well (sudo apt-get install easytag).
It allows the modification of tags (batch entry too - which is useful with lots of files) and also allows renaming - with sub-directories etc, as required. There are a few "smarts" in there too which can help, depending on the situation.
If you use KDE, you can use krename for a "find and replace". All you would do is to do a search such as *.mp3 in either Konqueror or Dolphin and then select all. Then you can right click and select Action>Rename with Krename. You can set up a rule for each change and then run all rules at once. It offers a preview and also an undo command if something goes wrong.
I would change it a bit to work on nested folders and to test if it works for you:
Code:
find /path/to/files -type f -print | grep [ÄÖÜäöüß¶] | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); echo mv "$file" "$N"; done
The output will show the files (filenames) to be changed.
If you are satisfied with the result do:
Code:
find /path/to/files -type f -print | grep [ÄÖÜäöüß¶] | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); mv "$file" "$N"; done
You also might want to change the grep part of this command. Insert all characters you don't want to have.
Be aware the characters are just deleted and not replaced.
If you also want to change names of paths remove the "-type f" option of the find command.
The command may take a long time to execute, you mentioned you have 35k songs. Just be patient.
__________________
Regards
sys64738
deleting chars is not a problem. thanks just what i needed.
Quote:
Originally Posted by vectordrake
You may also be able to do it with Thunar, the file manager used for xfce (you can use it without xfce), but you may have a lot to rename. I've used it with success for under 100 files.
Have you explored the rename command?
songs are scattered. thunar would not be much help here.
rename, i forgot about it.
thanks
Quote:
Originally Posted by l3ill
Since they are music files, are you only concerned about the file names or do you also want to rectify the IDx tags?
If only file names, then the above solutions are good - however, if you're interested in fixing up the tags; I had a similar issue with around 25,000 MP3 files - I used a variety of tag editors on both Windoze and Linux (Ubuntu) clients - and I found an application called "Easy Tag" which did the trick quite well (sudo apt-get install easytag).
It allows the modification of tags (batch entry too - which is useful with lots of files) and also allows renaming - with sub-directories etc, as required. There are a few "smarts" in there too which can help, depending on the situation.
All up, I'd say it's worth a look.
Cheers ... Bill
i wanna keep keep the tags intact, i dont care about filenames. i dont think easytag would rename dirs.
thanks for the suggestion.
Quote:
Originally Posted by purevw
If you use KDE, you can use krename for a "find and replace". All you would do is to do a search such as *.mp3 in either Konqueror or Dolphin and then select all. Then you can right click and select Action>Rename with Krename. You can set up a rule for each change and then run all rules at once. It offers a preview and also an undo command if something goes wrong.
i use xfce so ... , ok i would try it, if nothing else works.
I would change it a bit to work on nested folders and to test if it works for you:
Code:
find /path/to/files -type f -print | grep [ÄÖÜäöüß¶] | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); echo mv "$file" "$N"; done
The output will show the files (filenames) to be changed.
If you are satisfied with the result do:
Code:
find /path/to/files -type f -print | grep [ÄÖÜäöüß¶] | while read file; do N=$(echo $file | tr -cd '\11\12\40-\176'); mv "$file" "$N"; done
You also might want to change the grep part of this command. Insert all characters you don't want to have. Be aware the characters are just deleted and not replaced.
If you also want to change names of paths remove the "-type f" option of the find command.
The command may take a long time to execute, you mentioned you have 35k songs. Just be patient.
Code:
find /home/ununun/music/ -type f -print | grep [^[:print:]] | while read file; do N=$(echo $file | tr -cd '[:print:]'); mv "$file" "$N" ; done
mv: cannot move `/home/ununun/music/1/25/2/[2008] Me\327\262\302\263\326\262\302\260 Su\327\262\302\263\326\262\302\260 i\327\262\302\274\327\237\302\277\302\275 Eyrum Vi\327\262\302\263\326\262\302\260 Spilum Endalaust/08. Sigur R\327\262\302\263\326\262\302\263s - Illgresi.mp3' to `/home/manish/music/1/25/2/[2008] Me Su i Eyrum Vi Spilum Endalaust/08. Sigur Rs - Illgresi.mp3': No such file or directory
mv: cannot move `/home/ununun/music/1/25/2/[2008] Me\327\262\302\263\326\262\302\260 Su\327\262\302\263\326\262\302\260 i\327\262\302\274\327\237\302\277\302\275 Eyrum Vi\327\262\302\263\326\262\302\260 Spilum Endalaust/11. Sigur R\327\262\302\263\326\262\302\263s - All Alright.mp3' to `/home/manish/music/1/25/2/[2008] Me Su i Eyrum Vi Spilum Endalaust/11. Sigur Rs - All Alright.mp3': No such file or directory
mv: cannot move `/home/ununun/music/1/25/2/[2008] Me\327\262\302\263\326\262\302\260 Su\327\262\302\263\326\262\302\260 i\327\262\302\274\327\237\302\277\302\275 Eyrum Vi\327\262\302\263\326\262\302\260 Spilum Endalaust/07. Sigur R\327\262\302\263\326\262\302\263s - \327\262\302\263\327\237\302\277\302\275ra B\327\262\302\263\326\262\302\241tur.mp3' to `/home/manish/music/1/25/2/[2008] Me Su i Eyrum Vi Spilum Endalaust/07. Sigur Rs - ra Btur.mp3': No such file or directory
.
.
.
basically a filename is converted into esacape sequence form and mv wont detetect these files.
basically a filename is converted into esacape sequence form and mv wont detetect these files.
I think the problem is you've insufficient rights to "/home/ununun/music/1/25/2/" concerning to read or to
"/home/manish/music/1/25/2/" concerning to write.
Last edited by sys64738; 02-15-2012 at 05:39 PM.
Reason: missing word
I think the problem is you've insufficient rights to "/home/ununun/music/1/25/2/" concerning to read or to
"/home/manish/music/1/25/2/" concerning to write.
Code:
ls -l /home/ununun/music/1/25/2/
total 3944
drwxr-xr-x 4 ununun ununun 4096 Aug 23 12:23 2007 - All of a Sudden I Miss Everyone
drwxr-xr-x 2 ununun ununun 4096 Aug 23 12:23 65daysofstatic - We Were Exploding Anyway (2010)
drwxr-xr-x 3 ununun ununun 4096 Aug 23 12:23 M-THIH_by_CoC_for_mediaboom.org
drwxr-xr-x 2 ununun ununun 4096 Aug 23 12:23 The Six Parts Seven - Casually Smashed to pieces
drwxr-xr-x 2 ununun ununun 4096 Aug 23 12:23 The hawk is howling 2008
-rwxr-xr-x 1 ununun ununun 4007197 Aug 23 12:23 [2008] Me
drwxr-xr-x 2 ununun ununun 4096 Feb 15 17:20 [2008] Me???????? Su???????? i?????????? Eyrum Vi???????? Spilum Endalaust
drwxr-xr-x 2 ununun ununun 4096 Aug 23 12:23 [2009] it doesn't matter
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.