Knowledge Base

TreeSize



Question / Problem

Is there a way to use the command line to search for files not changed in x days and then delete them automatically?Currently we are doing this manually but would like to schedule it as a daily/weekly task.

Answer / Solution

TreeSize can search, report and delete files over a certain age using the file search. For security reasons we have designed the deleting operation bypassing the recycle bin not to be scriptable - with the exception of the possibility to move the files, which is available through the command line option /MOVETO (Professional Edition only). Any search options saved to an XML file can be passed at the command line and the results can be saved, for example:

TreeSize.exe /SEARCH /SAVE "C:\Temp\TSP\SearchResults.txt" "C:\Temp\TSP\Not Accessed since 01-07-2008.xml"

The results can also be moved:

TreeSize.EXE /SEARCH /MOVETO "C:\Temp\TST\Moved" "C:\Temp\TSP\Files ending with TMP.xml".

You may pass "Recycle Bin" as destination as well.