Avatar of nav2567
nav2567
Flag 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.
SSH / Telnet SoftwareShell ScriptingPowershell

Avatar of undefined
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.
ASKER CERTIFIED SOLUTION
AlexPace

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23