XDEL - an enhanced DEL command for OS/2 Copyright (c) 1995, 1996, 1997 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. ------------------------------------------------------------------------------- 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 options screen: Usage: XDEL [DRIVE:][PATH]FILENAME [/OPTION] [/OPTION] ... XDEL [DRIVE:]PATH [/OPTION] [/OPTION] ... FILENAME may contain wildcard characters such as '*' and '?'. 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 Deleted files cannot be recovered using the 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 Overwrite files before deletion /O+ Rename, move and overwrite files before deletion /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] ... Options set by environment variable need not to be specified in the command line. Installation Copy XDEL.EXE to a directory referenced by the PATH environment variable. XDEL was developed using emx-gcc 0.9c. The executable in this package was created by the OS/2 Linker LINK386. It is a stand alone version, emx.dll is not needed. Please send bug reports, comments and suggestions to klaus.joosz@usa.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 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 drives 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. Klaus Joosz September 30, 1997