Hi
I have the following script which works for me pretty well:
outputpath=/media/aragornvideos/PSP/
if [ -z $@ ]
then
echo "No argument"
exit
fi
show=$@
echo Looking for files in "/media/recordings/$show"
echo Looking for files in "/media/recordings/$show" >> updatepodcasts.log
ls /media/recordings/$show/*
for file in "/media/recordings/$show/*"; do
if [ -f $file ] ; then
filenopath=${file##*/}
echo "converting $outputpath$show/$filenopath.mp4" >> updatepodcasts.log
sleep 10
#handbrake command
./HandBrakeCLI -i $file -o $outputpath$show/$filenopath.mp4 --preset "PSP"
rm $file
sleep 10
fi
done
# ls /media/aragornvideos/PSP/* | while read filename; do mv "$filename" `echo "$filename"|sed 's/\.ts//'`;done
sleep 10
#remove files older than 9 days
echo "removing old files" >> updatepodcasts.log
find $outputpath$show/ -type f -mtime +9 -exec rm {} \;
echo "finished processing $show" >> updatepodcasts.log
Basically it grabs from the input directory, converts a file to PSP format and stick it on another machine.
Usually I call it with ./hbfriends Friends
So it goes to the /media/recordings/Friends directory and grabs all the recorded friends episodes.
Well now I'd like to add 3rd Ropck from the Sun to it as well.
I've tried ./hbfriends 3rd\ Rock\ From\ The\ Sun and this doesn't work, and yet I can type ls 3rd\ Rock\ From\ The\ Sun and this will bring back a file name.
Any help appreciated....