Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Ive got multiple mp3 files named like so:

artist - year - album - track - title.mp3

about half of them, due to a "rename from tag" error are named like this:

artist - year - album - track - title - - .mp3

how do I make the last example look like the first in ubuntu. Due to errors now in the tags, I am unable to use the tag program to rename the files with out messing up the currently correct file names, unless I spent a lot of time looking for and selecting for the mis-named files.

If I could move the mis-named files to another directory, I would be able to use the tag program to fix the file names, but how do I move ONLY the mis-named files?

thanks

share|improve this question

migrated from stackoverflow.com Dec 2 '11 at 15:04

This question came from our site for professional and enthusiast programmers.

    
Place [part of] output of ls -1 | cat -t. –  Vi. Oct 9 '11 at 20:33

3 Answers 3

Something like mv $(ls -1 | grep -- '- -') /path/to/dir_to_for_retagging/. Better do echo mv ... first to see what will it do.

share|improve this answer
    
mv $(ls -1 | grep -- '- -') /path/to/dir_to_for_retagging/ results in: mv: missing destination file operand after..destination directory –  Key Board Oct 9 '11 at 18:24
mv *--.mp3 /path/to/dir

should work fine.

share|improve this answer
    
May be mv *' - -.mp3' /path/to/dir/? There are space characters. –  Vi. Oct 9 '11 at 17:31
    
$ mv *' - - .mp3 ~/Desktop/u/ mv: cannot stat `-': No such file or directory for both dashes –  Key Board Oct 9 '11 at 19:05
    
mv --.mp3 /path/to/dir mv: cannot stat `--.mp3': No such file or directory –  Key Board Oct 9 '11 at 19:06

something like

for i in $(ls *--.mp3); do mv $i `echo $i | sed s/--// ; done

(untested). This'll remove all -- from the file names.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.