2

ncftpput with spaces in file names

view story
linux-howto

http://www.linuxquestions.org – Tried searching for this but had no luck. So if I missed the answer to my question please post a link. Hopefully I'm posting in the right area as this is my first post to this forum. Wrote me a nice script to upload only new files recursively from a directory. Only problem I'm having is when it comes to files with spaces in the name. According to the ncftp manual: ncftpput [options] remote-host remote-directory local-files... Where I run into trouble is the s on the end of local-files. Since you can put more than one file in the upload string the spaces in files simply look like seperate files and the upload fails. -----Script goes kind of like this----- upload=`find $local -newer $status -type f` touch $status if [ -z "$upload" ]; then echo "Nothing to do...exiting" exit else #SAVEIFS=$IFS #IFS=$(echo -en "\n\b") for each in $upload; do remote_dir=`echo "$each" | awk -F/ '{ print $6 }'` echo -en "\n\nRemote Directory=$remote_dir" echo -e "File Name=$each" cmd1="$ftp -b -u $username -p $passwd $host /$remote_dir ${each}" $cmd1 #IFS=$SAVEIFS done fi exit -----End Script----- I've tried it with and without the $IFS line and it still fails. Any ideas on how to make to do an upload with files that contain spaces? (Might have to break down and try something other than ncftpput but it works so well except for the space issue.) (HowTos)