Download Latest Version SubDirectoryCleanup-v1001.zip (360.4 kB)
Email in envelope

Get an email when there's a new version of SubDirectory Cleanup

Home
Name Modified Size InfoDownloads / Week
ver 1.0 2011-12-12
readme.txt 2011-12-12 6.3 kB
Totals: 2 Items   6.3 kB 0
------------------------------------------------------
|
|	Product   - SubDirectory Cleanup
|	Version   - 1.0.0.1
|	Author    - Tim Bare
|	Copyright - 2011 - Tim Bare
|
|	Website   - http://www.tbare.com
|	Project   - http://subdirectorycleanup.tbare.com
|
|	Description:
|	   SubDirectory Cleanup is an application
|	   that allows you to quickly and easily
|	   clean up old files from FTP folders,
|	   Job Folders separated by Company, etc. 
|	   whose age is greater than a specified
|	   number of days, and log it all - for FREE!
|
------------------------------------------------------

Usage:

SubDirectoryCleanUp.exe [/path "..."] [/days n] [/log "..."] [/logall] [/lognum n] [/logssize n] [/logonly] [/cleanuprootfiles] [/all]


---------------------
Parameters:

/path			[also '/p'] "C:\Path\To\Folder\To\Watch"
/days			[also '/d'] Max age of file (Looks at Modified date)
/log			[also '/l'] "C:\Path\To\LogFile.txt"
/logall			Log all deleted files - if not set, only errors will be logged (Locked file could not be deleted... etc.)
/lognum			[also '/ln'] Number of log files to keep
/logsize		[also '/ls'] Max size of log file in bytes ('262144' = 256KB or 1/4 MB)
/removesubl1		[also '/rl1' (letter 'R' letter 'L' number '1')] If set, will remove subdirectories directly under the initial path at end of execution if empty
/logonly		Do not actually delete files - instead, only log the files that WOULD have been deleted. - great for testing
/cleanuprootfiles	If set, files in the root folder (initial path) will be cleaned up if older than days specified
/deleteall		[also '/all'] If set, program will remove ANY files that are older than date specified. 
				If not set, will only delete Level 2 folders if ALL files and subfolders in that directory are older than specified age.
/deleteany		[also '/any'] Same as /deleteall


---------------------
What's this thing do / Why did I make it??

Long story short, I was tasked with creating a program that creates folders for jobs based on company and job number to distribute files for the customer to review.
Here's what the directory structure looks like:
C:\InitialFolder\
   Company1\
      Job1\
        File1
        File2
      Job2\
        Folder1\
           File1
        File1
        File2
   Company2\
      Job1\
        File1
        File2
      Job2\
        File1
        File2
 
The folder understandably got large, quickly...

So I was tasked with creating a program that goes in, and checks if ALL the files in the job folder were older than 30 days, wipe out that job folder, and everything in it.

This is the result... Modified to be useful in more scenarios (as I know I'm going to be tasked with cleaning up the FTP folder after n days, too...)


---------------------
Sample Usage:

============= ex1 =============

SubDirectoryCleanUp.exe /path "C:\Path\To\Watched Folder" /days 30 /log "C:\LogFile.txt" /logall /lognum 2 /logssize 262144 /rl1

============= ex1 results =============

 - /path "C:\Path\To\Watched Folder" -- Goes into each subfolder (Level 1) under "C:\Path\To\Watched Folder"
 - /days 30 -- For each Subfolder under that (Level 2), checks to make sure that **ALL** files and folders are older than 30 days old
    - If they are, delete all files and Level 2 subfolder and go to the next one
    - If not, go on to the next one.
 - /log "C:\LogFile.txt" -- Logs errors to "C:\LogFile.txt"
 - /logall -- Logs each file deletion to "C:\LogFile.txt"
 - /lognum 2 -- Keeps 2 log files
 - /logssize 262144 -- Starts a new log file when initial reaches 262144 bytes (256KB), renaming the older one to "C:\LogFile.txt.1"
 - /rl1 -- When finished, check all Level 1 folders - Delete the empty ones

*** - Files in the root of /path "C:\Path\To\Watched Folder" are not touched - Only subfolders under it. ***


With paths changed, this is the exact string i'm using for my "Why did I write this?" scenario above.


============= ex2 =============

SubDirectoryCleanUp.exe /path "C:\Path\To\Watched Folder" /all /days 90 /log "C:\LogFile.txt" /logall /lognum 2 /logssize 262144

============= ex2 results =============

 - /path "C:\Path\To\Watched Folder" -- Goes into each subfolder (Level 1) under "C:\Path\To\Watched Folder"
 - For each Subfolder under that (Level 2)
    - /all /days 90 -- Check for ANY file that is older than 90 days old - Delete it
    - Delete Level 2 directories if they're empty
 - /log "C:\LogFile.txt" -- Logs errors to "C:\LogFile.txt"
 - /logall -- Logs each file deletion to "C:\LogFile.txt"
 - /lognum 2 -- Keeps 2 log files
 - /logssize 262144 -- Starts a new log file when initial reaches 262144 bytes (256KB), renaming the older one to "C:\LogFile.txt.1"

*** - Files in the root of /path "C:\Path\To\Watched Folder" are not touched - Only subfolders under it. ***

With paths changed, this is the exact string i'll use for my FTP folder cleanup - it will keep all level 1 directories (virtual directories for each client) even if it wipes out all info inside...


---------------------
History:

Revision: v1.0.0.1
========================
-Bug Fix - Log File dialog is no longer checking if file exists (Program will create the log file for you when you run it)
-"About" screen now opens center screen along with the rest of the windows

Revision: v1.0.0.0
========================
- Initial Release


---------------------
Disclaimer:
This software is provided by the copyright holder and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Source: readme.txt, updated 2011-12-12