try this
http://www.icewalkers.com/Linux/Soft...20460/mvb.html
(i googled it)
I don't know much about programming but i need a program that renames all the files on a linux directory like this: whatever.mp3 to 001.mp3 or anything to 002.ogg. So i can send them to my dos mp3car without any problems. I know samba does that mangling thing but i need to rename the files on linux in order to make a playlist on my linux computer that is playable on the dos system.
Thanks in advance!
try this
http://www.icewalkers.com/Linux/Soft...20460/mvb.html
(i googled it)
I have been looking into something similar but don't have to worry about the 8.3 restriction and will be using ID3 tagging for music. Check out this project, it can rename and retag mp3s based upon the music signature. http://musicbrainz.org
Here's a bash shell script that will do the trick. It's quick and dirty. It doesn't do any error checking, if your files are named songsdasdasd.foobar, it won't truncate the extension to 3 characters. It will make sure not to write a filename bigger than 8 digits though.
I take no responsibility for this script. If it sets your puppy on fire and makes your child cry, that's your business.
----- End of script, don't include this line ------Code:----- Beginning of script, don't include this line ------ #!/bin/bash i=1; for file in * do ext=${file##*.} if [ "$file" != "$i.$ext" ]; then echo "moving $file to $i.$ext" mv $file $i.$ext else echo "skipping $file, already renamed." fi let i+=1 if [ "$i" -gt "99999999" ]; then echo "too many files to fit in 8.3 naming scheme" break; fi done
My worklog.
Status: VM GTI sold, got out of the CarPC tinkering hobby, but I still think about getting back in.
Interesting you're taking that approach. That's how my custom software imports files into it's permanent library, although I have no concern with DOS (when it imports it renames files as xxxxxx.mp3 and keeps track of where it left off for the next import).
You can use the find command like this to create a readable text file you can then iterate through to rename your files:
You can then use a simple for loop to iterate it as such:Code:find /source/of/mp3/files -name '*.mp3' -follow > /temp/text/file
I didn't test this but you get the idea. Hope that helps.Code:COUNTER=0 for MP3FILE in `cat /temp/text/file` ; do mv MP3FILE /destination/path/$COUNTER.mp3 COUNTER=$((COUNTER++)) done rm /temp/text/file
Huh, did I come up with almost the exact code? I didn't plan it out or anything, I'm sure there are better ways to solve the problem. I just started typing, tested it once and posted the code.Originally Posted by intuitionsys
My worklog.
Status: VM GTI sold, got out of the CarPC tinkering hobby, but I still think about getting back in.
You did more than meI mainly posted the snippet re "find" as it will find files recursively if that's of any use.
Bookmarks