Re: the old spaces in file names thingy in shell scripts

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Dale Farnsworth
Date:  
To: craig, PLUG-discuss
Subject: Re: the old spaces in file names thingy in shell scripts
In article <> you write:
> My script breaks if the file names have spaces...
>
> #!/bin/sh
> #
> BASE="/home/storage/users/craig/Desktop/dw"
> IN="in"
> OUT="out"
> for f in *.flv; do ffmpeg -i $f `basename $f.mp4 .flv`; done


I don't think the above basename args do what you want.

> mv *flv $BASE/$IN
> mv *mp4 $BASE/$OUT
>
> How can I fix this?


I think you want something like:

===== begin script =======
#!/bin/sh

BASE="/home/storage/users/craig/Desktop/dw"
IN="in"
OUT="out"

for f in *.flv; do
    MP4="`basename "$f" .flv`.mp4"
    ffmpeg -i "$f" "$MP4"
    mv "$f" "$BASE/$IN"
    mv "$MP4" "$BASE/$OUT"
done
===== end script =======


-Dale
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss