I am trying to knock up a quick script for my bro to use as he is not very comfortable at the command line.
I am trying to use zenity to pick multiple files and then use scp to shoot them over to my media server.
this is what I have so far.
Code:
#!/bin/sh
HOST="10.1.1.2"
DESTINATION="/home/djserver/Videos"
password="xxxxxxx"
FILE=`zenity --file-selection\
--title="Select a File"\
--multiple\
--separator=","`
# add \ for spaces in folders
echo $FILE | sed 's/ /\\ /g' > temp.txt
FILE=`cat temp.txt`
# replace the comma separating the file names with spaces
echo $FILE | sed 's/,/\ /g' > temp.txt
FILE=`cat temp.txt`
scp "${FILE}" djserver@$HOST:$DESTINATION
#echo scp "${FILE}" djserver@$HOST:$DESTINATION
I get the list of files that I choose with an error saying file does not exist. It is like it is treating the whole list as one file.
If I uncomment out the last line in the script, then copy and past it into a new shell. The transfer works. So I am not sure how I pass the command I wan't verbatim.
Any Ideas ?
Thanks
I am a BASH n00b
Bookmarks