Shell script sftp

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Shell script sftp

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Shell script sftp

Post 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.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply