Import file Maintenance

  • Tasks:

      • Move zipped file from source system to local

      • Unzip file

      • Import Data

      • Archive File Keep 3 files only per source system

      Archive Structure:

        • Archive Folder

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

         

    • Hi,

      You could achieve this through a simple script task.

      Regards

      Daniel

    • Viewing 2 posts - 1 through 1 (of 1 total)

      You must be logged in to reply to this topic. Login to reply