You are not logged in.
Pages: 1
Alright so here's my problem: I was importing a ton of MP3/4's from a friend's iPod, and apparently Rhythmbox decided it would be better to copy them and strip every single extension (Arch recongnizes them, but I need to put them on failtunes on their Windows PC, which requires the extensions to be correct). I know very well of the file command, however there are 781 files with no extension, and doing this manually would be hell. I've looked on the repos and the AUR for a program to set the file extensions based on the file type, along with maybe a script (tried doing one in Bash but I couldn't figure out how I'd manage something like that due to the lack of regex) or the like to do so on Google, but I have had no luck. Does anyone know how I could do this?
Offline
in bash...
shopt -s globstar
for file in **; do
IFS='/' read -r -d';' _ minor < <(file -bi "$file")
[[ "$minor" = mp4 ]] && ext=mp4 || ext=mp3
mv "$file" "$file".$ext
done
I don't believe you're going to hit the max args limit here with only 781 files.
Offline
Pages: 1