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

Re: Script to Read Windows Directory

Roy Schestowitz <newsgroups@xxxxxxxxxxxxxxx> writes:

>__/ [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.

That has always been one of the idiocies of Windows (which some writers in
Linux are picking up) It causes problems in Windows as well, since space is
the command separator everywhere. 

>> 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.

Well, you could redefine what is meant by whitespace, and then use tabs to
separate words in the command. 
Or you could do it by something like

cd /windows/C/music
for mp3file in *
echo "Backup" | mail -s "$mp3file" -a "$mp3file" buck01@xxxxxxxxx


find /windows/C/music -exec mail -s "\{\}" -s "\{\}" buck01@xxxxxxxxx \;
Why in the world you would back something up by mailing it I have no idea.
And mailing that same thing time after time as well.

>> 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.


>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