Page 1 of 1

Shell script sftp

Posted: Sun Mar 14, 2010 1:15 pm
by JKM
Hi there!

Could anyone help me out with a shell script that should..
- sftp myuser@myhost
- cd public_html/misc/
- mkdir `date --date='1 day ago' +%Y_%m_%d`
- cd `date --date='1 day ago' +%Y_%m_%d`
- put /home/localuser/files/*.log
- quit

Re: Shell script sftp

Posted: Mon Mar 15, 2010 7:09 am
by VladSun
-b option?
-b batchfile
Batch mode reads a series of commands from an input
batchfile instead of stdin. Since it lacks user
interaction it should be used in conjunction with non-
interactive authentication. sftp will abort if any of
the following commands fail: get, rm, and lmkdir.