Page 1 of 1

Delete old source files

Posted: Mon Nov 02, 2020 8:48 pm
by rgs
I'd like to back up a folder, then delete any source files older than 30 days, without deleting any destination files. Is this possible?

Re: Delete old source files

Posted: Wed Mar 22, 2023 6:22 pm
by vchung5
I know this post is quite old. But were you ever able to figure out how to do this? I'm also trying to figure out to implement the same thread scenario. Any input would be helpful!

Re: Delete old source files

Posted: Wed Mar 22, 2023 7:39 pm
by tobias
Hello,
wow, apparently I never replied to this.

Well there are at least three ways to implement it.

I think the best way is to have two jobs. One for the main backup, and the other one to delete old files.

The main backup job needs to be "Standard Copying", and it must not delete any files from the destination. So even if you delete or rename a file, it will remain on the backup.

The second job should use the mode "Move Files to Destination". Click the Configure button to specify that existing files which are identical or older on the source side should be deleted from the source side. Then go to "Masks & Filters" -> "File Age and Size" and specify File Age: older than 30 days.

So this second job will only process files older than 30 days. And it will delete those from the source if they already exist at the destination.

-----

The second way would use a different kind of job for deleting older files, as described here:
https://www.syncovery.com/documentation ... an-x-days/

-----

The third way would use a PascalScript function to delete older files. The advantage would be that you only need one job. If you want this let me know and I'll write the script.
https://www.syncovery.com/pascalscript/

Re: Delete old source files

Posted: Thu Oct 12, 2023 5:15 pm
by PicoStallone
Tobias,

Did you ever end up writing the Pascal Script you mentioned? If not, could you please write it and post to this topic? That would be quite helpful.

Re: Delete old source files

Posted: Thu Oct 26, 2023 10:21 pm
by tobias
Hello,
I am working on it now.

Re: Delete old source files

Posted: Sat Oct 28, 2023 8:04 pm
by tobias
Hello,
the script can now be downloaded from the PascalScript page on my web site. It's the last of the "Useful ready-to-use scripts":

https://www.syncovery.com/pascalscript/

There is some explanation of the script functionality on that page too.

It can be added to a profile via the advanced settings category "Job" -> and there the PascalScript... checkmark. This will open a window where the script text can be pasted. The script file itself does not need to exist anywhere on your computer.

Re: Delete old source files

Posted: Wed Nov 08, 2023 5:02 pm
by PicoStallone
Hi Tobias,

I finally got around to running the script but it throws the following error "Could not compile the Pascal script in this profile. [Error] (20:9): Unknown identifier "CountDeletedFiles'.

I see this variable called in script but it doesn't appear to be defined. Can you take a peek and advise how to tweak the script to avoid this error?

Re: Delete old source files

Posted: Wed Nov 08, 2023 6:39 pm
by tobias
Hi,
it's a function. You need the latest Syncovery version to use it.

Re: Delete old source files

Posted: Wed Nov 08, 2023 10:27 pm
by PicoStallone
After upgrading from 10.7.8 to 10.8.3 the script worked as intended. Thanks for writing the script. Very helpful!