FTP Download only new files

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
efyzz
Posts: 5
Joined: 25 Nov 2016 06:56

FTP Download only new files

Post by efyzz » 28 Aug 2018 21:15

Hello,

Is there any possibility to download only new files with the FTP Download action? Normally existing files in the local directory are overwritten, but I want to download only new files, that not exist on target yet.

Thanks in advance!

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: FTP Download only new files

Post by Martin » 01 Sep 2018 19:11

Hi,

Unfortunately that's quite complicated. You'd have to use an action FTP Init Variable File List and remove all files from the list that are already available locally and then download the rest.

Regards,
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: FTP Download only new files

Post by Desmanto » 02 Sep 2018 17:19

Since there is not direct way, you can use script to do it.

Use action Init Variable File List and save to variable {local}
Use action FTP Init Variable File List and save to variable {ftp}

Use script and remove all existing file list from ftp

Code: Select all

download = removeAllElementValues(ftp, local);
{download} now contains only the files exist in {ftp} but not in {local}.

Then use FTP Download Files with the {download,listformat,comma} as the path.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply