Tasks:
Archive Structure:
- Source1 Folder
- Source2 Folder
- Archive1.zip
- Archive2.zip
- Archive3.zip
- Archive4.zip
Source3 Folder
Problem:
I have set up a for each loop for each archived folder to loop though and count the number of files saved. If there are more than 3 files I want to delete the oldest file. It is very possible there could be multiple files during a given day. Is there any way to compare the date on the file (not in the filename) to find out which one is the oldest?
One thing I've considered but feel is cludgy is using the rename funciton of the File System task. IE if there are more than 3 files, then loop through and change any .zip2 to .zipdel and any .zip1 to .zip2 and .zip to .zip1 then deleting the .zipdel. I'd like a cleaner way to accomplish.
If anyone has done something similiar, I'd appreciate the feedback.