Looking at sftp (with Cygwin at the moment, but it should be extremely similar if not the same).
Just from typing "sftp -help" I see a few things that make me think it's definitely possible. Most notable being the line "sftp [[user@]host[:file [file]]]", and maybe even better, the option above "[-b batchfile]".
Knowing nothing about the batchfile option, and little about the file specifications in the other, I take myself over to the man page for it (man sftp).
The batchfile option looks like it will probably be exactly what you are looking for...
Code:
-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. A
batchfile of `-' may be used to indicate standard input. sftp
will abort if any of the following commands fail: get, put,
rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp,
lpwd and lmkdir. Termination on error can be suppressed on a
command by command basis by prefixing the command with a `-'
character (for example, -rm /tmp/blah*).
So, looking at this, it looks as if you could simply make a file (we'll call it batch.ftp), and put a series of commands in it, each on their own line. For example (note: this assumes you are achieving access without a password prompt thanks to ssh keys in place...if that's not the case, let me know and we can either help set that up for you, or get around it another way):
Code:
put myfile1.txt
cd myfiles
put myfile2.txt
My understanding is that this file, run at the command line with sftp like this: sftp -b batch.ftp user@host
Will result in you connecting, putting myfile1.txt in your login directory, changing to the myfiles directory, and putting myfile2.txt into the myfiles directory.
All in all, I think this will get the result you're looking for...I hope...
I have to apologize too, I get to wordy at times and tend to have scatterbrained thoughts, so please forgive me if that's the case, and just tell me to clarify.
