top of page
  • Writer's pictureChris Keim

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.


Script Features

  • Moves files that past a certain time frame (in days) to a different folder


Script Prerequisites

  • Before doing anything, backup your data

  • Test the script in your environment and verify results prior to running the scrip in production


Script Disclaimer

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 Language

  • VB Script


Script How To

  1. Modify the variable strRootFolder with the root folder you want to scan.

  2. Modify the variable strLogFilePath with the directory you want the log file to be placed.

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

  4. Modify intExpiration for the expiration in days for the files. File expiration is calculated based on the last modified date of the file.

  5. Modify strArchive with the location of where to move the expired files to.


The Script


27 views0 comments
bottom of page