File Archive Script
Many companies have a “free zone” or area of space usually accessible by a network share or FTP. This area is used for temporary space for transferring or sharing files. I say temporary because this area gets cleaned out (or at least should be cleaned out) every so often.
Moves files that past a certain time frame (in days) to a different folder
Before doing anything, backup your data
Test the script in your environment and verify results prior to running the scrip in production
Run this script at your own risk. But, don’t be too scared as I have run this in many production environments with no issues.
Script How To
Modify the variable strRootFolder with the root folder you want to scan.
Modify the variable strLogFilePath with the directory you want the log file to be placed.
Modify arrExclusions(0) with a directory you want to exclude from this process. If you need multiple directories excluded, create a new variable with the next available number, for example arrExclusions(1). Any subfolders of these exclusions will not be scanned as well.
Modify intExpiration for the expiration in days for the files. File expiration is calculated based on the last modified date of the file.
Modify strArchive with the location of where to move the expired files to.