Synchronize. Backup. Manual. Automatic.

Whatever your backup or sync scenario, ChronoSync Express has got you covered!

Back to more guides

MORE GUIDES

Deleting Old Files

INTRODUCTION

ChronoSync Express can perform some interesting operations when you combine a couple of features in a creative way. In this case, you can use ChronoSync Express to scan a file/folder hierarchy and delete any files that are older than a specified date. This is useful in the situation where you have a large number of files that you want to cull through and remove files that haven't been modified for a long period of time.

Use the steps in this guide to create two synchronizer documents with the necessary rules that, when run in sequence, will delete files that have not been modified in the past 180 days (6 months).

Step 1. Set up the first Synchronizer document.

The first document is used to build an empty duplicate of the folders where you want to perform the deletions. This duplicate can be placed anywhere, just choose a location separate from the folder where the files will be deleted.

Create a new sync document. On the 'Setup Panel', set the Left Target to the location where the files will be deleted. In this example, I 'Choose' the folder called “My Old Files” located in my “Documents” folder.

Next, set the Right Target to the location used to build the empty folder hierarchy. In this example, I click 'Choose' on the Right Target pane, create a new folder in my Documents folder called “My Empty Old Files”, and set that folder as the Right Target.

Verify that the 'Operation:' popup between the target panes is set to “Backup Left-to-right”.

Step 2. Create "File Size" rule.

Switch to the 'Rules' panel and create a 'File Size' rule. Just place a checkmark in the box next to 'File Size' and set the options to 'is less than', 0 (zero), and 'KB'. This tells ChronoSync Express to only sync files that are less than 0KB in size. When this synchronization is run, no files will be copied to "My Empty Old Files" because no file can have a data size less than zero. However, every folder in "My Old Files" will get recreated in "My Empty Old Files".

Create File Size rule for filtering sync

Step 3. Save the Synchronizer document.

Use the File->Save menu item to save this sync document someplace where you can find it later. Use a memorable name like “Create Empty Old Files”. Don't run the sync yet. We'll do that in Step 6.

Step 4. Create a second Synchronizer document.

The second synchronizer document is used to perform the file deletions. Create a new sync document. On the 'Setup Panel', set the Left Target to the empty folder location, “My Empty Old Files”.

Next, set the Right Target to the location where the files will be deleted: “My Old Files”. The Left and Right Targets in this sync document are opposite of the targets chosen in the first sync document.

Set the 'Operation:' popup between the target panes to “Mirror Left-to-right”. Below the 'Operation' popup, place a checkmark in the box next to 'Synchronize deletions'. The default setting for deletions is to “Move to Archive”. This is a safety feature to keep from accidentally deleting something important. Only change this option if you have tested the sync documents and are confident that you won't lose any important files during the deletion. There are testing suggestions at the conclusion of this guide.

Step 5. Create "Date/Time Last Modified" rule.

Switch to the 'Rules' panel and create a 'Date/Time Last Modified' rule. Just place a checkmark in the box next to 'Date/Time Last Modified' and set the options to 'File', 'is before', and '-180:00:00:00'.

The first option needs to be set to “File” for this procedure to work. Don't use the default "File or folder" option or you won't get the desired result.

The "-180:00:00:00" is a relative date and time that means "180 days ago". Don't forget the negative sign! This rule tells ChronoSync Express: “Only consider files that have a Last Modified date and time that is before 180 days ago.” Running this sync will delete all files which have not been modified in the past 180 days. Files newer than 180 days ago will be untouched.

You can use whatever number you want here to indicate the time frame desired for the deletion of files. For example, if you want files older than 45 days to be deleted, use "-45:00:00:00". To learn more about using relative dates in Rules, be sure to view our guide on using “Relative Dates”.

Create Date Modified rule for filtering sync

Be sure to save this new sync document with a memorable name so you have it for Step 6.

Step 6. Create a container document.

These two newly created sync documents should be run in order. One method you can use to accomplish this is to create a Container sync document. Use the 'File->New->Container' menu item to create a new Container document.

Switch to the 'Documents' panel and use the 'Add' toolbar button to add the newly created sync documents. Make sure that document #1 runs first by placing it first in the document list. If you plan to re-use this sync, name and save your container as well.

Important Note. Be Careful!

Be very careful when setting up and testing these sync documents since you are dealing with deletions and don't want to accidentally delete something because you made a mistake. You can run the sync documents manually and in order by first clicking 'Synchronize' on the document #1 toolbar.

Next, switch to the 'Analyze' panel on document #2. Use the 'Show All' checkbox to reveal all the files and folders that will be affected by the sync rule. You can also use “Trial Sync” to get a preview of the results of the synchronization.