Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

migrated from 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

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

You must log in to answer this question.