#!/bin/sh # This UNIX shell script FTPs all the files in the input directory to a remote directory # It uses a UNIX Shell "hear document" to read the commands to the FTP program from the shell file # You have to use the -n option to the FTP command to disable the prompting for the password # the quote in front of the ftp user and pass are also necessary to disable reading from stdin # the prompt must be turned off for the multi-put to not prompt the user LOCALDIR=mylocaldir REMOTESERVER=remote.server REMOTEPATH=/my/remote/path LOGIN=myloginname PASSWORD=mypassword cd $LOCALDIR ftp -n $REMOTESERVER <<INPUT_END quote user $LOGIN quote pass $PASSWORD cd $REMOTEPATH prompt off mput *.* exit INPUT_END
Ruminations on NoSQL, XRX, XQuery, Semantics, STEM, Arduino, Internet-of-Things (IoT) and empowering the non-programmer.
Thursday, August 17, 2006
UNIX Shell Script to Transfer Files via FTP
I recently needed a UNIX shell script to transfer all my files to the web collaboration server running plone. Although you can do this with Ant's FTP command, my remote system just had UNIX. Here is the script I wrote.
Subscribe to:
Post Comments (Atom)
3 comments:
Thanks sir :) ur script has helped me in our application development.
Thanks m8, but what if i want to make sure the file is successfully transfered? and if not to automatically retry send it?
Good script thanks alot it has helped me to solve my problem.
but in the scipt exit command need to be removed instead put quit to quit from ftp
Post a Comment