LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Special characters in filenames (https://www.linuxquestions.org/questions/linux-general-1/special-characters-in-filenames-399648/)

gmartin 01-04-2006 09:21 PM

Special characters in filenames
 
I have a directory full of wav files I need to convert using lame. If I try the obvious 'lame *.wav' I get an error because the filenames globbed with *.wav are full of spaces and dashes. using "*.wav" or '*.wav' both fail.

I know I've seen this before, but can't find an answer. Can you help?

Thanks

bigrigdriver 01-05-2006 07:50 AM

Try a batch rename of the files to replace spaces with underscores.

cd to the directory with the .wav files, then use this command:

for i in *.wav; do mv "$i" `echo $i | tr ' ' '_'`; done

Notice the back-ticks around the echo command.

gmartin 01-05-2006 08:22 PM

OK you stimulated my memory. I think I did before this without renaming by using

for i in (*.wav); do lame -V0 "$i"; done

Now if I can figure out how to pick out the extension so I could pass file + extension then just filename.


Thanks for the help. Maybe I'll remember next time


All times are GMT -5. The time now is 09:57 AM.