
		XDEL - an enhanced DEL command for OS/2 

		    Copyright (c) 1995, 2004 Klaus Joosz
			  All rights reserved.

    This program is free software. It is distributed in the hope that it 
    will be useful, but WITHOUT ANY WARRANTY.
    Please read this file carefully. I am in no way responsible for any 
    damages XDEL may cause on your system.

-------------------------------------------------------------------------------

XDEL is an extension of the OS/2 DEL command. It will delete the specified 
file(s) in a directory and all subdirectories contained within. This includes
system, hidden and read only files. Files can be selected by timestamp, size
or may contain a specified string. Extended attributes of files can be deleted
without deleting the files themselves.

This is the XDEL help screen:

Usage: XDEL DELFILES INPUTFILES OPTIONS

            DELFILES:   [DRIVE:][PATH]FILENAME ...
                        [DRIVE:]PATH ...

            INPUTFILES: @[DRIVE:][PATH]FILENAME ...

DELFILES are files or directories to be deleted.
INPUTFILES are text files containing names of files and directories to be
deleted, one name per line.
DELFILES and files listed in INPUTFILES may contain wildcard characters such as
'*' and '?'. Wildcards in directory names are not supported, any expression
containing wildcards is regarded as a file name.
At least one DELFILE or INPUTFILE must be specified.

Options are:
  /A:SEARCHSTRING
      Delete files containing the specified string (search is case sensitive)
  /B:[OPERATOR]FILESIZE
      Delete files whose size (in byte) is less than, less equal, greater than,
      greater equal, equal or not equal to the specified size.
      If OPERATOR is omitted, less than is assumed.
  /D  Delete empty subdirectories
  /EA[:EXTENDED ATTRIBUTE]
      Delete the extended attribute specified after the colon but do not delete
      the file itself. If EXTENDED ATTRIBUTE is omitted all EAs of a file are
      deleted.
  /F  Do not move deleted files into DELDIR directory if DELDIR environment
      variable is set. This disables file recovery via OS/2 UNDELETE command.
  /I  Ignore settings in environment variable XDEL-DEFAULT-OPTIONS
  /L  Do not list deleted files
  /N  Start deletion without warning
  /O[:PATTERN]
      Overwrite files before deletion. If PATTERN is specified the file
      is overwritten as often as there are characters in PATTERN each time
      using a different character out of PATTERN.
  /O+[:PATTERN]
      Rename, move and overwrite files before deletion. If PATTERN is specified
      the file is overwritten as often as there are characters in PATTERN each
      time using a different character out of PATTERN.
  /O-[:BYTES]
      Rename, move and partially overwrite files before deletion. BYTES specifies
      the size of the portion that is overwritten. If BYTES is omitted 0 is assumed.
  /P  Pause on each file
  /Q  Pause on each directory
  /R  Delete READ ONLY files
  /S  Delete matching files in subdirectories
  /T:[OPERATOR]YEAR[-MONTH[-DAY[-HOURS[-MINUTES]]]]
      Delete files with last write access less than, less equal, greater than,
      greater equal, equal or not equal to the specified date and time.
      If OPERATOR is omitted, less than is assumed. Format of date and time is
      yyyy-mm-dd-hh-mm.
  /U:FILENAME
      Exclude file(s) from deletion. FILENAME may contain wildcard characters.
  /X  Do not delete files in READ ONLY directories
  /Y  Deletion of empty subdirectories will also affect READ ONLY directories
  /?  Display this help message

OPERATORs are:
  LT  Less Than
  LE  Less Equal
  GT  Greater Than
  GE  Greater Equal
  EQ  EQual
  NE  Not Equal

Options and operators are not case sensitive

The above options can be set by environment variable for permanent use:
  SET XDEL-DEFAULT-OPTIONS=OPTION OPTION ...
Example:
  SET XDEL-DEFAULT-OPTIONS=/O /N /L
Options set by environment variable need not to be specified in the command
line.

XDEL can be stopped any time by pressing a key.




Installation
------------

Copy XDEL.EXE to a directory referenced by the PATH environment variable.

Although XDEL has been compiled with emx-gcc it is a stand alone version. 
emx.dll is not required.

Please send bug reports, comments and suggestions to klaus.joosz@gmx.net.


History
-------

Version 1.03
  
  Fixed a bug with Novell NetWare 3.12: while scanning for subdirectories, 
  normal files were found also. 


  Directories with the HIDDEN attribute are now found.

 
  Empty subdirectories with the READ ONLY attribute set will only be removed 
  when the /Y option is used. 
  It seems that OS/2 does not care about the READ ONLY attribute on local 
  drives, so whether or not this attribute is set an empty subdirectory can 
  be deleted with the RD command. On Novell network drives the READ ONLY 
  attribute is supported.
  Directory attributes can be displayed and removed with the ATTRIB command.
  For I haven't found a command line tool to set directory attributes I wrote 
  one of my own. The tool is called ATTRDIR.EXE and should be included in this 
  package.


Version 1.04

  Added switch /X to prevent files in READ ONLY directories from being deleted.


  Fixed a bug parsing the [DRIVE:][PATH]FILENAME expression in the command 
  line.


  Added switch /T to exclude files with last write access newer than a certain
  point of time from deletion. The last write access can be displayed by the
  DIR command.


Version 1.05

  Overwriting files now is significantly faster.


  Added new command line syntax: XDEL [DRIVE:]PATH [/OPTION] [/OPTION] ...
  Now you can specify the name of a directory to delete all files in that
  directory. Instead of
    XDEL \TMP\*
  you can type
    XDEL \TMP
  The empty subdirectory is not deleted automatically. To delete it add the /D
  switch.


  Extended switch /T. Now you can delete files with a timestamp less than,
  less equal, greater than, greater equal, equal or not equal a certain date
  and time. To do so use the operators LT, LE, GT, GE, EQ and NE as mentioned
  in the usage section of this file.
  You can also combine two /T switches like that:
    XDEL *.BAK /T:GE1997-05-01 /T:LE1997-05-31
  This example shows how to delete all BAK files in the current directory
  with last write access in May 1997.
  If no operator is specified along with the /T switch LT is assumed.


  Added switch /B to select files by size. The size must be specified in
  byte. This switch supports the operators LT, LE, GT, GE, EQ and NE.
  Two /B switches can be combined like that:
    XDEL *.BAK /B:GE1000 /B:LT10000
  In this example all BAK files in the current directory with size from 1000
  to 9999 byte are deleted.
  If no operator is specified along with the /B switch LT is assumed.


  Added switch /A to delete files containing a certain string. If two or 
  more /A switches are given only files containing all specified strings are
  deleted.
  String search is case sensitive.
  If the string contains blank characters use double quotes like that:
    XDEL *.BAK /A:"This string contains blank characters"
  You can specify up to 16 /A switches in the command line.


  Added switch /EA to delete extended attributes of files.
  For example, you can delete the .LONGNAME and the .VERSION attributes of
  all BAK files by typing
    XDEL *.BAK /EA:.LONGNAME /EA:.VERSION
  Delete all extended attributes of all BAK files by typing
    XDEL *.BAK /EA
  If the /EA switch is given only extended attributes of files are deleted
  not the files themselves. To delete extended attributes of read only
  files add the /R switch to the command line. Extended attributes of 
  directories are not deleted.
  You can specify up to 16 /EA: switches in the command line.


  Pressing any key during execution of XDEL brings up the dialog
  "Terminate XDEL ([Y]es [N]o) [A]bort)". When overwriting large files
  or searching for text in large files the dialog might not appear
  immediately after the key stroke.


Version 1.06

  Changed dialog "Terminate XDEL ([Y]es [N]o) [A]bort)" to 
  "Abort XDEL ([Y]es [N]o)".


  Fixed a bug when deleting all extended attributes of files via the /EA
  switch. Version 1.05 deleted up to a maximum number of 32 EAs per file.
  Now ALL extended attributes of a file are deleted.


  Added switch /O+ to clear information stored in the name, location and
  timestamp of a file. This is a extension of the /O switch.
  Even if a file cannot be recovered you can guess its contents from its
  name, its directory and its timestamp. The switch /O+ helps you to avoid
  this.
  On HPFS and JFS drives XDEL will move the file to the root directory of 
  its drive, rename it, reset its timestamps, overwrite its contents with null
  characters and finally delete it.
  For example, you issue the command
    XDEL C:\SECRET_SERVICE\TOP_AGENTS\JAMES_BOND.TXT /O+
  This will move the file JAMES_BOND.TXT from the directory TOP_AGENTS to
  the root directory of drive C:, rename it to something like 15320001.tmp
  and set its timestamps to 01-01-1980 00:00 before it is overwritten and
  deleted.
  After this procedure a file recovery tool such as File Phoenix or GammaTech
  Undelete will not find a file named JAMES_BOND.TXT, neither in its original
  directory nor in any other directory.
  On FAT drives moving a file from one directory to another will not clear
  the filename completely in its original directory. Its first character
  will be replaced by a '?' to mark it deleted and a file recovery tool
  would find the filename entry ?AMES_BOND.TXT (if a FAT drive could handle
  long filenames). Therefore on FAT drives and on any other non HPFS/JFS 
  drive XDEL will rename a file in its original directory without moving it.


  Added switch /U:FILENAME to prevent the file(s) matching FILENAME from
  being deleted. FILENAME may contain wildcard characters but must not
  contain any drive or path information. The following example clears the
  cache directory of a famous navigator from all temporary files but keeps
  the file FAT.DB:
    XDEL \NETSCAPE\CACHE\*.* /U:FAT.DB
  You may want to keep all the HTM files also:
    XDEL \NETSCAPE\CACHE\*.* /U:FAT.DB /C:*.HTM
  A maximum number of 16 /U switches can be handled by XDEL.


Version 1.07

  When overwriting a large file XDEL now brings up the dialog 
  "Abort XDEL ([Y]es [N]o)" immediately after a key is pressed. Earlier versions
  finished the currently processed file before bringing up the dialog.
  If you select "Yes" the file remains partially overwritten but undeleted in
  its original directory.


  When using switch /A:SEARCHSTRING to delete files containing a certain piece
  of text pressing a key now brings up the dialog "Abort XDEL ([Y]es [N]o)"
  immediately even if a large file is processed.


  Enhanced file overwriting capabilities. The new syntax of the /O and /O+
  switches allows to enter a pattern from which the characters for overwriting
  a file are taken:
    /O[:PATTERN]
    /O+[:PATTERN]
  The file is overwritten as often as there are characters in PATTERN each time
  using a different character out of PATTERN.
  Example:
    XDEL SECRETS.TXT /O:2L8
  This will overwrite the file SECRETS.TXT three times, first time using the
  digit "2" second time using the character "L" and finally using the digit "8".

  Characters that cannot be found on the keyboard may be entered by typing
  their decimal ASCII code. An ASCII code which is part of PATTERN consists of
  a backslash and three digits. Valid ASCII codes reach from \000 to \255.
  The pattern in the following example contains one character. The ASCII code
  of the character is 1 which in many ASCII tables is represented by a smiling
  face.
    XDEL SECRETS.TXT /O:\001
  Here is another example:
    XDEL SECRETS.TXT /O+:\255ou812B4\000


  The new switch /O-[:BYTES] behaves similar to the /O+ switch except that
  instead of the whole file a portion of it is overwritten. BYTES specifies
  the size of the portion. If BYTES is omitted 0 is assumed i.e. no part of
  the file is overwritten.


  Enhanced command line. While earlier versions of XDEL allowed exactly one
  file or directory to be specified in the command line this version supports
  multiple filenames and directories, limited only by the amount of characters
  the command line can hold.
  Example:
    XDEL C:\*.TMP C:\*.OLD C:\*.BAK /S
  This will delete all *.TMP, *.OLD and *.BAK files in the root directory of
  drive C: and in all subdirectories.
  

  XDEL now reads names of files and directories to be deleted from an input
  file. The first character of the expression containing the input file name
  must be a "@" to prevent it from being deleted like the other files passed
  to XDEL in the command line.
  Example:
    XDEL @D:\Utils\DelFileList.Txt /s /r
  The input file may contain several file names, one per line:

    *.TMP
    *.OLD
    ;this is a comment
    *.BAK
    C:\WIN95\WIN.COM

  Another example shows how to delete the input file AFTER it has been 
  processed:
    XDEL *.TMP *.OLD @GARBAGE.TXT GARBAGE.TXT /s
  This won't work:
    XDEL *.TXT @GARBAGE.TXT /s


Version 1.07a

  Fixed a bug where XDEL did not recurse into subdirectories with only the
  archive attribute set when the /S option was specified.


Version 1.07b

  When deleting empty subdirectories XDEL did not check for key strokes. So it
  was impossible for the user to abort XDEL as long as it was deleting just
  subdirectories and no files. This bug was fixed.


Version 1.08

  Speed up overwriting files.

  The switch /0 (zero) now is part of the online help. It was already
  present in older versions of XDEL.
  The switch /0 makes XDEL save files with a file size of 0 before deleting
  them. Recovery of files processed that way will result in empty files.
  (the file recovery tools I checked did not even find these files.)
  When using /0 along with one of the /O switches files are overwritten 
  before they are saved with a file size of 0.


Version 1.09

  XDEL now is able to open files > 2GB on JFS drives. Such files may be 
  overwritten using one of the /O switches or searched for strings using 
  the /A switch. Of course searching in such large files is very time 
  consuming.

 
  When using /O+ or /O- switch files were renamed before deletion, 
  but directories were not. This version of XDEL fixes that bug.


  XDEL now deletes extended attributes of directories. Older versions deleted 
  extended attributes of files only.
  To delete extended attributes of directories you must use the /D switch 
  along with the /EA switch.

  Examples:
  Delete all EAs of all files and subdirectories located in C:\TMP:
    XDEL C:\TMP\* /s /d /ea

  Delete all EAs of all subdirectories located in C:\TMP:
    XDEL C:\TMP\* /s /d /ea /u:*

  Delete the .LONGNAME extended attribute of directory D:\TemporaryFiles:
    XDEL D:\TemporaryFiles /ea:.LONGNAME /u:* /d

  Please note that older versions of XDEL deleted empty subdirectories when 
  the /D switch was used along with the /EA switch.


						    Klaus Joosz
						    December 28, 2004
