For deleting files, a manual interactive approach is always recommeneded. However, if you must do this automatically, the following script will delete files based on specified criteria - top folder, size, last access time.
Code:
# Script DeleteLargeFiles.txt
# Input arguments
var str topfolder, accesstime
var int size
# Collect a list of files in $topfolder,
# - whose accesstime is earlier than $accesstime, and
# - whose size is greater than $size.
var str list, file
lf -r -n "*" $topfolder (($ftype=="f") AND ($fsize > $size) AND ($fatime < $accesstime)) > $list
while ($list <> "")
do
# Get the next file to delete.
lex "1" $list > $file
# Delete file.
echo -e "DEBUG: Deleting file " $file
# system del ("\""+$file+"\"") UNCOMMENT THIS LINE.
done
This is a biterscripting script. Save the script in file C:/Scripts/DeleteLargeFiles.txt, then call the script as follows.
Code:
script "C:/Scripts/DeleteLargeFiles.txt" topfolder("C:/test") size(1024*1024) accesstime("20090101")
The above script call will delete files under C:/test that exceed size of 1M Bytes which have not been accessed since Jan 1, 2009.
Please test the script well before using on real files (in a test C:/test directory). As you may notice, I have commented out the line that deletes the found files (system del). Uncomment that line after you are sure that the script is finding the correct files.
You can pass values of your choice to input arguments topfolder(), size() and accesstime().
Bookmarks