Link to home
Start Free TrialLog in
Avatar of nav2567
nav2567Flag for United States of America

asked on

use mget to copy newer files only.

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.
Avatar of giltjr
giltjr
Flag of United States of America image

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.
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.
ASKER CERTIFIED SOLUTION
Avatar of AlexPace
AlexPace
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial