0

I need to upload a large number of images from lots of local folder to ftp folders with other names. I have a CSV file with match between local and remote folder, such as:

/local/folder/A, /remote/folder/10
/local/folder/B, /remote/folder/13
/local/folder/C, /remote/folder/150

and I am trying to upload in /remote/folder/10 all the files contained in /local/folder/A and so on. I'd prefer bash script.

This is the script I already wrote:

#!/bin/bash 
HOST=ftp.xxx.it
USER=yyy           
PASSWD=zzzz       

ftp -n $HOST <<END_SCRIPT

quote USER $USER
quote PASS $PASSWD
lcd /first/local/folder
cd /first/remote/folder
mput *.jpg

quit
END_SCRIPT
exit 0

As I said, I have got a CSV file with the couple of folders (local/remote) correctly matched, but I don't know the way to insert the CSV information in this script.

  • I guess nobody will write a script for you. Add your solution instead of "I'd prefer bash script" and we can check what is bad. – stderr Feb 16 '16 at 10:01
0

Sorry, I didn't mean "write a script for me", just "suggest the way to write a bash script". In any case, this is the script I already wrote:

#!/bin/bash 
HOST=ftp.xxx.it
USER=yyy           
PASSWD=zzzz       

ftp -n $HOST <<END_SCRIPT

quote USER $USER
quote PASS $PASSWD
lcd /first/local/folder
cd /first/remote/folder
mput *.jpg

quit
END_SCRIPT
exit 0

As I said, I have got a CSV file with the couple of folders (local/remote) correctly matched, but I don't know the way to insert the CSV information in this script.

Thank you in advance,

Matteo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.