Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-04-2006, 09:21 PM   #1
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Rep: Reputation: 40
Question 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?

Old 01-05-2006, 07:50 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,891

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
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.
Old 01-05-2006, 08:22 PM   #3
Registered: Mar 2003
Location: PA
Distribution: Slackware 13.37 Linux Reg # 341245
Posts: 285

Original Poster
Rep: Reputation: 40
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
special characters greenbox Linux - Software 9 12-23-2005 07:33 PM
Comment out special signs in filenames Lobais Linux - Software 3 09-02-2005 11:17 AM
bash and filenames with special characters CoolAJ86 Programming 2 03-09-2005 02:50 PM
sftp with filenames and weird characters Nevion Linux - Software 1 05-28-2004 05:29 AM
smbclient and filenames with special characters cloro_x Linux - Newbie 0 07-30-2001 04:15 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration