msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

09 Jan 2008 SFTP in batch mode

Posted by

This post describes how you use sftp in batch mode. If you don’t want to type in your password read my SSH without a password post.Create a file named myCommands.sftp that contains the commands you want to run. My file looks like this

# Change to your desired directory locallylcd /data/Hattori# Change to the desired directory on the remote servercd /backup# Transfer all remote files locallyget *# We're done with this sessionbye

Next you run the sftp session

sftp -b myCommands.sftp example.com

That should be all that is necessary to download your files from the remote server.This example could easily have been extended with a crontab entry.

Tags: , ,

Comments are closed.