.sh script, I'm using
expect to automatically
sftp to another computer in order to
get files. My script will be set to run every 30 minutes, at which point I want to
get only files that were created (modified) since the last run (risking repetition, within the last 30 minutes). I know that the files will follow a specific naming method:
* will be a date and time string. However, I do not know when the files will be created or transferred to the computer I am communicating with, nor do I know how many there could be as the number will vary.
... /usr/bin/expect<<EOD spawn sftp user@host expect "User's password: " send "$password\r" expect "sftp>" send "get ????" EOD ...
I searched for help with
get and found references to using the
-neweronly switch, as well as trying
synchronize. However, I don't know how to implement either of these, or if
synchronize is even an option in
Also, the computer that I have to
sftp to stores incoming files in a directory with thousands of older files (from 2013 to present), so it's imperative that I only get files from the last half hour.