
xdel.exe

This program is an extended version of the built-in del command 
in Windows 2000/XP/2003/Vista. You can delete files based on how old 
they are.

USAGE

xdel [-dodelete] [-dirsonly|-filesonly] [-ctime TIME|-mtime TIME]
     [-recurse|-r] [-force] [-datetime culture] [-enumcultures]
     [-dolog|-l] [-verbose|-v] [-debug]
     dir[\pattern]
     
NOTES:
1: The -dodelete is required before any changes will be made to the
   file system. This offers a chance to REVIEW what will happen,
   before the actual DELETION takes place. Its omission is similar
   to adding -listonly.
2: This utility will NOT delete files marked READ-ONLY, and thus
   will skip any directory that contains at least one READ-ONLY
   file, unless the -force option is added.
3: Deletions are PERMANENT. That is they are NOT moved to the
   recycle bin! IT IS UNLIKELY DELETED ITEMS CAN EVER BE RECOVERED!!
4: Even with the -dodelete, the program still asks for confirmation
   before proceeding to do the deletion. There is a parameter to 
   override this confirmation so the process can be sheduled and 
   automated, but even then, the program watches the keyboard for
   about 60 seconds before proceeding, and any keyboard entry other
   than a 'Y' during this wait will abort the process ... this delay
   can NOT be over-ridden!
   
EXAMPLES

xdel -dodelete -ctime Now-3d "D:\Microsoft SQL Server\Backup\*"

	Deletes all files with a create time prior to Now() minus
	3 days. Looks in the folder being specified and the 
	search pattern being specified, *. (Does not delete any
	directories)

xdel -dodelete -mtime Now-5d -dirsonly "C:\ReplData\*"

	Deletes all directories in the specified path (and all files
	inside those directories) that have a modify time prior
	to Now() minus 5 days.

xdel -dodelete -ctime Now-256d -listonly "D:\Documents and Settings"

	Does not perform any deleting. Simply prints the list of
	the files that would be deleted if -listonly was not specified.

xdel -dodelete -datetime fr-FR -mtime 2008-09-04 23:00 -force folder

    Accept the modify time in French format, and delete ALL files
    in the directory called folder, if they are older than 04/09/2008
    11:00 PM, even if they are marked READ-ONLY (-force).

xdel -dodelete -dirsonly -mtime "file=a date file.doc" -force folder

	Using the DateTime of the file "a date file.doc", delete ALL
	direcotories in the directory called folder, even if they contain
	file with READ-ONLY set, that are older than "a date file.doc".

PARAMETERS

-dodelete   Without this parameter, NO deletion will take place. Its
            non presence is similar in effect to -listonly.

-listonly   Do not delete any directories or files. Just print out 
            the files or directories that would be deleted.

-dirsonly   Look only at directories and delete directory and all
            contents inside directory. This is powerful, so beware.

-filesonly  Default. Cannot be used when -dirsonly is specified.
            Will delete files only. Directories will not be examined.

-recurse    Will seek inside all directories under the [dir] being
            specified. Without recurse xdel will only search the
            current directory. But note -dirsonly is resursive by
            nature.

If neither a creation, nor modification time is given, then xdel will
default to deleting all files earlier than the current date/time, which,
in effect, is _ALL_ files!

-ctime TIME Creation time of the file or directory.

-mtime TIME Last modification time of the file or directory.

TIME        This method supports three different TIME parameters.

1.          A "Now-%d" lexicon. The DateTime to look at is based on
			Now (the current date and time when xdel is invoked),
			minus %d, (the number of days to subtract from Now).

2.          A dd/mm/YYYY HH:MM:SS format, in the Great Britain cultural
            format by default. That is 'en-GB'. This cultural format
            can be set by the [-datetime culture], to like en-US, fr-FR,
            etc. The switch -enumcultures will fully enumerate the
            list of cultures avalable, and exit.

3.          A "file=name-of-file" lexicon. The DateTime to use is
            based on the DateTime of the file name given. That is all
            file/directories earler than the DateTime of this file.

-datetime culture : As mentioned in 2. above, the culture of the TIME
            can be set using this switch.

-enumcultures : Will output a list of cultures that can be used with
            the above, and exit, doing nothing else.

-debug      Print out debug information regarding what files and/or
            directories are being analyzed for their mtime or ctime
            values.

-verbose    Similar to -debug, but more things are shown during the 
            analysis of directories and files. This can also used as -v,
            and can be used multiple times to increase the verbosity.

-dolog      By default will append to a file called xdel.log.txt.
            This allows a log to be kept if xdel is being run within 
            the Scheduled Tasks system in Windows.

-newlog     A new log file will be create - that is, delete any existing
            log and start a new, rather than the default append.

-setlog logfile : Set the log file name to a new name. The default is
            xdel.log.txt, but can be switched for this run to any valid
            file name.

-please-NO-confirmation : NOT A RECOMMENDED PARAMETER! It is case sensative,
            and long, to remind you that this is very DANGEROUS. A faulty
            command can delete IMPORTANT files, without asking.
            *** BE STRONGLY WARNED ***

dir         The directory to start the search in.

pattern     The pattern to search for such as *, or bak*, or s*, or *.bak,
            etc. Only file matching this PATTERN will be deleted.

Parameters can be entered in any order on the command line, and xdel will
abort operations if it detects an 'unknown' command or parameter.

IT IS RECOMMENDED THAT YOU ALWAYS DO A -listonly COMMAND FIRST, PERHAPS WITH
A -v (VERBOSE), TO REVIEW WHAT IS GOING TO BE DELETED. THE COPIOUS OUTPUT SHOULD
BE READ CAREFULLY BEFORE PROCEEDING.

ADDING -dolog WILL WRITE THE RESULTS TO A TEXT LOG FILE, AND YOU CAN REVIEW
EVEN VERY LONG LISTS. TAKE DUE CARE WITH YOUR FILE SYSTEM. THERE ARE MANY
DIRECTORIES AND FILES WHICH SHOULD NEVER BE DELETED.

-----------
Written by John Lauer. Bugs and comments to: jlauer .-at-. simplewire .-dot-. com.
Modified by Geoff R. McLane: If you must, ubuntu .-at-. geoffair .-dot-. info
-----------

Date: 5 September, 2008
