YVG Software Services masthead

Scripts - Cleanup By Age

Description

Schedule this script to run periodically in order to keep from accumulating too much "junk". You will be able to automate the deletion of files and folders based on age. Results can be emailed (if run from a Windows server) or a report will be generated in your "My Documents" folder.

If you only want to see how much space you could recover or simply want to play without having to worry about deleting something important, make sure you set testmode to "on" (or "true" or "yes" or "1").

Download

Download CleanupByAge script (~6KB)

Usage

CleanupByAge 
   - REQUIRED
    This is the starting folder to clean.  All
    subfolders will be subject to cleaning/deletion
    based on the age threshhold.

  [notify=]
    The e-mail address to receive reporting information

  [from=]
    The originating e-mail account

  [days=] - defaults to 30
    If a file or folder is equal to or greater in age
    than the number of days passed, it will be deleted.
    If not passed, this defaults to 30 days.

  [dateattribute=] - defaults to created
    If a file or folder is equal to or greater in age
    than the number of days passed, it will be deleted.
    If not passed, this defaults to 30 days.

  [testmode=] - defaults to "off"
    Turning this on turns this into a reporting only
    script.  No files/folders will be deleted, however
    the report will reflect information on what would
    have been processed if things had been deleted.

  [showok=] - defaults to "off"
    When this setting is "on", the resulting report
    will list ALL files processed and not just the
    files that were deleted.

  [ignorefolders=] - defaults to "off"
    When this setting is "on" folders will not be
    removed even if their age is older than the
    threshold.

  [onlyfolders=] - defaults to "off"
    When this setting is "on" only folders will be
    removed as long as they are empty and their
    age exceeds or equals the threshold.
          

Revision History

-----------------------------------------------------
April, 19 2004                             
-----------------------------------------------------
- Cosmetic changes
- Reports number of folders deleted
-----------------------------------------------------
March 30, 2004                             
-----------------------------------------------------
- Cosmetic changes
-----------------------------------------------------
March 29, 2004                             
-----------------------------------------------------
- Added option to only process folders
- Enhanced error messages to include script section
  that caused the error
-----------------------------------------------------
June 5, 2003                               
-----------------------------------------------------
- Added option to not remove folders
-----------------------------------------------------
December 15, 2001                          
-----------------------------------------------------
- If email address is provided, but for some reason
  an address cannot be sent, a log file will be
  created so that reporting information is not lost.
- Error handling finally added.  Errors will be
  logged inline in the report.
- Logfiles are not written to a "Cleanup Logs"
  folder that is created in "My Documents".  If the
  folder does not exists, it will be created.
- Log file naming has changed to list the path
  before the date/time.  Should allow for easier
  grouping in Windows Explorer.
-----------------------------------------------------
December 13, 2001                          
-----------------------------------------------------
- Fixed problem where files/folders were deleted
  only if age was exceeded by a day.  Now files are
  deleted if their age is greater than or equal to
  the threshold number of days.
- Cosmetic changes.
- Added options for date attributes other than
  only allowing deletion based on file creation
  date.
-----------------------------------------------------
December 12, 2001                          
-----------------------------------------------------
- Modified command line options to allow for 
  drag-and-drop folder cleaning.  
- Checks to see if what was passed as the starting 
  folder exists and is indeed a folder.  
- E-mail address arguments are now optional.  
- If no addresses are passed, the script
  will generate an HTML file locally.  This means that
  the script is now usable on workstations and not
  just servers.
- If only "notify" or "from" are passed, the
  option not passed uses the value from the
  option that was passed.
-----------------------------------------------------
December 11, 2001                          
-----------------------------------------------------
- Folder deletion added.
- Documentation in the form of comments added.
- Added graphical usage information at end of report.
-----------------------------------------------------
December 10, 2001                          
-----------------------------------------------------
- Modified for command line use instead of requiring
  the script to be modified for every instance.
-----------------------------------------------------
November 27, 2001                          
-----------------------------------------------------
- Script created.
          

site navigation home page about us our customers forum
extras wallpaper scripts downloads
contact info

Email: info@yvg.com

Phone: 270.462.3557

Get Firefox!
YVG Software Services footer image