I use psftp to connect to a remote sftp server and copy files to a local server and is currently using mget * to copy everything.
Is it possible to copy just the newer files only?
Please advise.
Thanks.
SSH / Telnet SoftwareShell ScriptingPowershell
Last Comment
AlexPace
8/22/2022 - Mon
giltjr
No, because there is no definition of "newer".
You would need to write a script that somehow identifies the files you want to download and download only them.
David VanZandt
One workaround: DOS/Windows uses a simple flag (archive bit) on the file header to indicate whether the file has changed since its last backup. That bit could be set off when a mget has successfully run. Thereafter, if the source file hasn't changed, you know it can be passed over.
Variation: copy the source file(s) to a zip archive, then ftp the zip to the target. Unpack the zip if the zip copy is newer than the target copy.
You would need to write a script that somehow identifies the files you want to download and download only them.