OverviewIn a previous post, we taught you how to automatically delete old files from your file transfer server. That exercise could come in handy if you want to recover some free space from your disk drive. However, there can be instances when, instead of deleting aged files, archiving/zipping would be your desired course of action. This article can help teach you how to zip old files.
When is archiving the better option?
There are many instances when you just can't delete old files. Maybe they're covered by a regulatory requirement (e.g. PCI DSS requirement 3.1). Maybe it's stipulated in your data retention policy. You might need it for operational or eDiscovery purposes. Who knows? Unless you're absolutely sure that the information found in those files are totally useless, it's best to send them to a zip file instead of the trash bin.
What we'd like to do
How to zip old files
One way to zip old files on JSCAPE MFT Server is by setting up the following:
- A directory monitor that would scan a specific directory for aged files;
- A trigger that would activate the directory monitor at some specified time; and
- Another trigger that would automatically zip each aged file found by the directory monitor.
We've already discussed this in the article "How To Delete Old Files From Your Server", so please go there and follow the instructions except the part in Step 3 where you add the Delete File trigger action. Instead of adding that, please add the Zip File trigger action.
In the succeeding screen, enter the %File% variable into the File field. You can leave the Destination field blank. If you do that, the zipped file will be stored in the same directory as the original file. But if you want it to be stored elsewhere, just enter the desired target folder.
Also, if you want to delete the original file, just tick the Delete Source check box.
Note that the instructions found in that article ("How To Delete...") are designed to delete files at least a year old. Please modify accordingly. For example, you might want to change the age parameter to, say, 60 days.
If you followed all the instructions (including those in the previous post) to the letter, this is what's going to happen:
1. As soon as the clock strikes 9:30 PM, the Activate Year Old Files Monitor trigger will activate the Year Old Files directory monitor.
2. The directory monitor will dive into the directory it's assigned to monitor and scan for 1 year old files.
3. If a 1 year old file is found, the Directory Monitor File Aged event will then fire.
4. This event will subsequently cause the Nightly File Deletes (you might want to change this to something more appropriate, e.g. Nightly File Zips) trigger to execute.
5. The trigger checks to see whether the monitor that fired the Directory Monitor File Aged is the Year Old Files monitor. If it is, the trigger proceeds to execute its Zip File trigger action.
6. The trigger action executes, using the value of the %File% variable to determine which file it should zip. The file in question is archived.
7. The Year Old Files directory monitor continues scanning the directory for more 1 year old files. If another one is found, the process is repeated starting at step #3.
Note that these instructions can be used irregardless of the file transfer protocol. In other words, you can apply this to your SFTP, FTPS, HTTPS, or FTP server as long as it runs on JSCAPE MFT Server.
Other articles you might find interesting:
If you like to read more posts like this, subscribe to this blog or connect with us on social media.