keep certain number of backup file

Share and discuss your flows and ideas with other users.

Moderators: MURTUMA, Martin

Posts: 11
Joined: 05 Dec 2018 16:14

keep certain number of backup file

Postby yxd0018 » 12 Jan 2019 14:24

I'm using google drive(experimental) to backup flow everyday. I use date as part of file name. I wonder if there is a way to keep last 3 backup file in gdrive.
Option2 is if it's not available, is there a sample flow to do the same thing on local drive then I can delete all the files on gdrive, upload local copies.
Option3 will be keep desired copies locally then use foldersync to sync to gdrive.

User avatar
Posts: 1400
Joined: 21 Jul 2017 18:50

Re: keep certain number of backup file

Postby Desmanto » 12 Jan 2019 18:37

Just init file list the Gdrive folder after you upload. Then check if the list length is more than 3, delete the oldest one.

I have a very complex idea about the backup flow to store 1 week and some special backup. But again, I was distracted and never complete it until now.
Index of Automagic useful thread List of my other useful posts (and others')

Posts: 11
Joined: 05 Dec 2018 16:14

Re: keep certain number of backup file

Postby yxd0018 » 12 Jan 2019 21:16

Can you share your generic clean up flow? I guess I need to write script to sort by timestamp in desc order, right?

User avatar
Posts: 1400
Joined: 21 Jul 2017 18:50

Re: keep certain number of backup file

Postby Desmanto » 13 Jan 2019 18:48

I am back editing my AM backup flow as your reply yesterday. Finally finish it partially, but was distracted too to complete 2 of other flow parts, in order to help creating this flow :lol: I need some time to try and use the my flowception to help testing the backup. Only then, I will share it (Although haven't finish all, but at least fully functioning for the finished part).

The core function of the removing is simply Action Init variable file list (in your case the gdrive list). The result is list of the files, sort by name. Since you use the date as part of the name, the oldest one will be the first one on the list. Simply create a script after the init
Code: Select all
dellist = newList();

if(length(files) > 3)
  addElement(dellist, files[0]);

This will check if the list of files is more than 3, then add the first element (the oldest one) to the delete list. Use {dellist} in action Delete files, after the script. (in your case delete from gdrive). you might want to try in in local folder first, and make sure you copy the folder as backup and as test files.
Index of Automagic useful thread List of my other useful posts (and others')

Return to Flow Sharing Area

Who is online

Users browsing this forum: No registered users and 8 guests