Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Script to Read Windows Directory

__/ [Buck Turgidson] on Saturday 22 October 2005 14:58 \__

> I have some mp3 files in a windows directory that I want to back up with a
> mail command.  However, it appears that, due to spaces in the windows file
> names, it gets garbled.
> 
> Is there a way to either get it to accept the name, or strip the spaces out
> of it?
> 
> Here is the script and the output.
> 
> 
> for mp3file in `ls /windows/C/music/*`
> do
>   #echo "Backup" | mail -s $mp3file -a $mp3file buck01@xxxxxxxxx
>   echo "$mp3file"
> done
> 
> 
> The file "/windows/C/music/Muddy Waters - Got My Mojo Working.mp3"
> 
> looks like this from the echo command:
> 
> /windows/C/music/Muddy
> Waters
> -
> Got
> My
> Mojo
> Working.mp3

I'd venture to guess that the format of the strings is improper. What you
ought to have is:

"/windows/C/music/Muddy\ Waters\ -\ Got\ My\ Mojo\ Working.mp3"

I suspect that if you exchnage 'ls' with something else, you will be able to
get past this problem.

'man echo' gives a few options that control trailing spaces and newlines.

Roy

PS - Do Google acknowledge that use of their 2 GB mail storage area? *wink*

-- 
Roy S. Schestowitz      |    /earth: file system full
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
  2:05pm  up 58 days  2:19,  9 users,  load average: 0.77, 0.81, 0.67
      http://iuron.com - next generation of search paradigms

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index