Delete old source files

English Support for Syncovery on Windows.
Post Reply
rgs
Posts: 2
Joined: Mon Nov 02, 2020 7:35 pm

Delete old source files

Post 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?

vchung5
Posts: 1
Joined: Thu Mar 16, 2023 7:50 pm

Re: Delete old source files

Post 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!

tobias
Posts: 1589
Joined: Tue Mar 31, 2020 7:37 pm

Re: Delete old source files

Post 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/

PicoStallone
Posts: 12
Joined: Tue Nov 02, 2021 5:09 pm

Re: Delete old source files

Post 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.

tobias
Posts: 1589
Joined: Tue Mar 31, 2020 7:37 pm

Re: Delete old source files

Post by tobias »

Hello,
I am working on it now.

tobias
Posts: 1589
Joined: Tue Mar 31, 2020 7:37 pm

Re: Delete old source files

Post 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.

PicoStallone
Posts: 12
Joined: Tue Nov 02, 2021 5:09 pm

Re: Delete old source files

Post 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?

tobias
Posts: 1589
Joined: Tue Mar 31, 2020 7:37 pm

Re: Delete old source files

Post by tobias »

Hi,
it's a function. You need the latest Syncovery version to use it.

PicoStallone
Posts: 12
Joined: Tue Nov 02, 2021 5:09 pm

Re: Delete old source files

Post by PicoStallone »

After upgrading from 10.7.8 to 10.8.3 the script worked as intended. Thanks for writing the script. Very helpful!

Post Reply