micky
2015-08-10 12:02:29 UTC
https://jpsoft.com/help/index.htm?overview.htm
DEL / ERASE command - Erase files or directories
Extended Delete Command, part of TCC/LE, from JPSoft,
a free cmd substitute.
Actually I posted because I was impressed by /B, delete after reboot.
And /I, match descriptions!
And file exclusion ranges.
Purpose: Erase one file, a group of files, or entire
subdirectories
Format: DEL [ranges] [/A:[[-|+]rhsadecijopt /E /F /I"text" /K /L
/N[defjnst] /O:[-]adegnrstu /P /Q /R /S[[+]n] /T /W[n] /X /Y /Z] [@file]
file...
file The file, subdirectory, or list of files or
subdirectories to erase.
@file A text file containing the names of the files to delete,
one per line (see @file lists for details).
/A: (Attribute select)
/P(rompt)
/B (Delete after reboot)
/Q(uiet)
/E (No error messages)
/R(ecycle bin)
/F(orce delete)
/S(ubdirectories)
/I (match descriptions)
/T(otal)
/K (no Recycle Bin)
/W(ipe)
/L (delete symlinks)
/X (remove empty subdirectories)
/N (Disable)
/Y(es to all prompts)
/O:... (Order)
/Z(ap hidden and read-only files)
File Selection
Supports command dialog, attribute switches, extended wildcards, ranges,
multiple file names, and include lists. Use wildcards with caution on
LFN volumes; see LFN File Searches for details.
Can be used with FTP/HTTP Servers.
Usage
DEL and ERASE are synonyms. You can use either one. In the description
below, every reference to DEL applies equally to ERASE. If you don't
specify any arguments, DEL will display its command dialog.
Use the DEL command with caution. The files and subdirectories that you
erase may be impossible to recover without specialized utilities and a
lot of work.
To erase a single file, simply enter the file name:
del letters.txt
You can also erase multiple files in a single command. For example, to
erase all the files in the current directory with a .BAK or .PRN
extension:
del *.bak *.prn
When you use DEL on an LFN drive, you must quote any file names which
contain white space or special characters.
To exclude files from a DEL command, use a file exclusion range. For
example, to delete all files in the current directory except those whose
extension is .TXT, use a command like this:
del /[!*.TXT] *
When using exclusion ranges or other more complex options you may want
to use the /N switch first, to preview the effects of the DEL without
actually deleting any files.
***
If you enter a subdirectory name, or a filename composed only of
wildcards (* and/or ?), DEL asks for confirmation (Y or N) unless you
specified the /Y option. If you respond with a Y, DEL will delete all
the files in that subdirectory (hidden, system, and read-only files are
only deleted if you use the /Z option). NOTE: The Windows command
processor, CMD, behaves the same way but does not ask for confirmation
if you use /Q to delete files quietly. If you want TCC to follow CMD's
approach and skip the confirmation prompt when /Q is used, set the
Prompt on Wildcard Deletes configuration option. Use caution if you
disable this option, as this will allow DEL /Q to delete an entire
directory without prompting for confirmation.
DEL displays the amount of disk space recovered, unless the /Q option is
used (see below). It does so by comparing the amount of free disk space
before and after the DEL command is executed. This amount may be
incorrect if you are using a deletion tracking system which stores
deleted files in a hidden directory, or if another program performs a
file operation while the DEL command is executing.
Remember that DEL removes file descriptions along with files. Most
deletion tracking systems will not be able to save or recover a file's
description, even if they can save or recover the data in a file. This
applies to the use of DEL with the Windows Recycle Bin, too - the
description will be lost.
When a file is deleted without using the Recycle Bin, its disk space is
returned to the operating system for use by other files. However, the
contents of the file remain on the disk until they are overwritten by
another file. If you wish to obliterate a file or wipe its contents
clean, use the /W option, which overwrites the file before deleting it.
Use this option with caution! Once a file is obliterated, it is
impossible to recover. Remember: /W overrides using the Recycle Bin.
DEL returns a non-zero exit code if no files are deleted, or if another
error occurs. You can test this exit code with the %_? internal
variable, and use it with conditional commands (&& and ||).
Use caution when using wildcards with DEL on LFN drives, because TCC's
wildcard matching can match both short and long filenames. This can
delete files you did not expect; see LFN File Searches for additional
details.
DEL sets three internal variables:
%_del_dirs The number of directories deleted
%_del_files The number of files deleted
%_del_errors The number of errors
Recycle Bin
When you delete files with DEL, TCC does not move the deleted files to
the Windows Recycle Bin by default. You can change this default with the
Delete to Recycle Bin configuration option. If you have disabled the
recycle bin, you can override the setting and place deleted files in the
recycle bin with the /R option:
del /r letters.txt
If you have enabled Recycle Bin support, but want to override the
default setting on a one-time basis, and delete some files without
placing them in the recycle bin, use the /K option:
del /k letters.txt
You can also exclude files from the Recycle bin, even if Delete to
Recycle Bin is enabled, or if the command use the /R option, with the
RecycleExclude environment variable.
FTP Usage
If you have appropriate permissions, you can delete files on FTP
servers. For example:
del ftp://ftp.abc.com/index
You can also use the IFTP command to start an FTP session on a server
and then use one of the following syntax examples:
del ftp:path/*.txt
del ftp:/path/*.txt
The first syntax will normally be interpreted by the server as relative
to the path you specified when you used the IFTP command to start the
FTP session. The second syntax, with a slash before the path name, is
interpreted as starting from the root.
NTFS File Streams
DEL supports file streams on NTFS drives. You can delete an individual
stream by specifying the stream name, for example:
del streamfile:s1
If no stream name is specified the entire file is deleted, including all
streams.
See NTFS File Streams for additional details.
Options
/= Display the DEL command dialog to help you set the filename and
command line options. You cannot specify any other arguments on the
command line.
/A: Delete only those files that have the specified attribute(s)
set. See Attribute Switches for information on the attributes which can
follow /A:. Do not use /A: with @file lists. See @file lists for
details.
You can specify /A:= to display a dialog to help you set individual
attributes.
/B If DEL can't delete the file (for example, if access is denied)
it will schedule it to be deleted at the next reboot.
/E Suppress all non-fatal error messages, such as "File Not Found."
Fatal error messages, such as "Drive not ready," will still be
displayed. This option is most useful in batch files and aliases.
/F This option has the same effect as /Z (see below): it deletes
read-only, hidden, and system files as well as normal files.. It is
included for compatibility with CMD.
/I"text" Select filenames by matching text in their descriptions.
The text can include wildcards and extended wildcards. The search text
must be enclosed in double quotes, and must follow the /I immediately,
with no intervening spaces. You can select all filenames that have a
description with /I"[?]*", or all filenames that do not have a
description with /I"[]".
/K Physically delete files instead of sending them to the Windows
Recycle Bin.
/L Delete symlinks instead of their contents.
/N Do everything except actually delete the file(s). This is useful
for testing the result of a DEL.
A /N with one or more of the following arguments has an alternate
meaning:
d Skip hidden directories (when used with /S)
e Don't display errors
f Don't display the bytes freed in the summary
j Skip junctions (when used with /S)
n Don't update the file descriptions
s Don't display the summary
t Don't update the CD / CDD extended directory search database
(JPSTREE.IDX)
/O:... Sort the files before processing.
You may use any combination of the sorting options below. If multiple
options are used, the listing will be sorted with the first sort option
as the primary key, the next as the secondary key, and so on:
n Sort by filename and extension, unless e is explicitly included.
This is the default.
- Reverse the sort order for the next sort key
a Sort names and extensions in standard ASCII order, instead of
numerically when numeric substrings are included in the name or
extension.
d Sort by date and time (oldest first); also see /T:acw
e Sort by extension
g Group subdirectories first, then files
r Reverse the sort order for all options
s Sort by size
t Same as d
u Unsorted
/P Prompt the user to confirm each erasure. Your options at the
prompt are explained in detail under Page and File Prompts.
/Q Don't display filenames as they are deleted, or the number of
files deleted or bytes freed. If Prompt on Wildcard Deletes is disabled
then /Q also disables the normal confirmation prompt when performing
wildcard deletions (e.g. DEL *), for compatibility with CMD. Use caution
if you disable Prompt on Wildcard Deletes, as this will allow DEL /Q to
delete an entire directory without prompting for confirmation. See also
/T.
/R Delete files to the Windows Recycle Bin.
/S Delete the specified files in this directory and all of its
subdirectories. This is like a GLOBAL DEL, and can be used to delete all
the files in a subdirectory tree or even a whole disk. Do not use /S
with @file lists. See @file lists for details.
If you specify a number after the /S, DEL will limit the subdirectory
recursion to that number. For example, if you have a directory tree
"\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.
If you specify a + followed by a number after the /S, DEL will not
delete any files until it gets to that depth in the subdirectory tree.
For example, if you have a directory tree \a\b\c\d\e, /S+2 will not
delete anything in \a or \a\b.
/T Don't display filenames as they are deleted, but display the
total number of files deleted plus the amount of free disk space
recovered.
/W[n] Overwrite the file contents using the DoD 5220.22-M (E) standard
for secure deletion. (This overwrites every byte in the file with
different values). You can optionally specify the number of passes
(1-999); the default is 3. See also DelWipePasses. Use this option to
completely obliterate a file's contents from your disk. Once you have
used this option it is impossible to recover the file even if you are
using an undelete utility, because the contents of the file are
destroyed before it is deleted. /W will override a /R.
/X Removes empty subdirectories (only useful when used with /S). If
DEL deletes one or more directories, they will be removed automatically
from the extended directory search database. DEL will display the
directories being removed (with a trailing \).
/Y The reverse of /P . It assumes a Y response to everything,
including deleting an entire subdirectory tree. TCC normally prompts
before deleting files when the name consists only of wildcards or a
subdirectory name (see above); /Y overrides this protection and should
be used with extreme caution!
/Z Delete read-only, hidden, and system files as well as normal
files. Files with the read-only, hidden, or system attribute set are
normally protected from deletion; /Z overrides this protection, and
should be used with caution. Because EXCEPT works by hiding files, /Z
will override an EXCEPT command. However, files specified in a file
exclusion range will not be deleted by DEL /Z.
For example, to delete the entire subdirectory tree starting with
C:\UTIL, including hidden and read- only files, without prompting (use
this command with CAUTION!):
del /s /x /y /z c:\util\
DEL / ERASE command - Erase files or directories
Extended Delete Command, part of TCC/LE, from JPSoft,
a free cmd substitute.
Actually I posted because I was impressed by /B, delete after reboot.
And /I, match descriptions!
And file exclusion ranges.
Purpose: Erase one file, a group of files, or entire
subdirectories
Format: DEL [ranges] [/A:[[-|+]rhsadecijopt /E /F /I"text" /K /L
/N[defjnst] /O:[-]adegnrstu /P /Q /R /S[[+]n] /T /W[n] /X /Y /Z] [@file]
file...
file The file, subdirectory, or list of files or
subdirectories to erase.
@file A text file containing the names of the files to delete,
one per line (see @file lists for details).
/A: (Attribute select)
/P(rompt)
/B (Delete after reboot)
/Q(uiet)
/E (No error messages)
/R(ecycle bin)
/F(orce delete)
/S(ubdirectories)
/I (match descriptions)
/T(otal)
/K (no Recycle Bin)
/W(ipe)
/L (delete symlinks)
/X (remove empty subdirectories)
/N (Disable)
/Y(es to all prompts)
/O:... (Order)
/Z(ap hidden and read-only files)
File Selection
Supports command dialog, attribute switches, extended wildcards, ranges,
multiple file names, and include lists. Use wildcards with caution on
LFN volumes; see LFN File Searches for details.
Can be used with FTP/HTTP Servers.
Usage
DEL and ERASE are synonyms. You can use either one. In the description
below, every reference to DEL applies equally to ERASE. If you don't
specify any arguments, DEL will display its command dialog.
Use the DEL command with caution. The files and subdirectories that you
erase may be impossible to recover without specialized utilities and a
lot of work.
To erase a single file, simply enter the file name:
del letters.txt
You can also erase multiple files in a single command. For example, to
erase all the files in the current directory with a .BAK or .PRN
extension:
del *.bak *.prn
When you use DEL on an LFN drive, you must quote any file names which
contain white space or special characters.
To exclude files from a DEL command, use a file exclusion range. For
example, to delete all files in the current directory except those whose
extension is .TXT, use a command like this:
del /[!*.TXT] *
When using exclusion ranges or other more complex options you may want
to use the /N switch first, to preview the effects of the DEL without
actually deleting any files.
***
If you enter a subdirectory name, or a filename composed only of
wildcards (* and/or ?), DEL asks for confirmation (Y or N) unless you
specified the /Y option. If you respond with a Y, DEL will delete all
the files in that subdirectory (hidden, system, and read-only files are
only deleted if you use the /Z option). NOTE: The Windows command
processor, CMD, behaves the same way but does not ask for confirmation
if you use /Q to delete files quietly. If you want TCC to follow CMD's
approach and skip the confirmation prompt when /Q is used, set the
Prompt on Wildcard Deletes configuration option. Use caution if you
disable this option, as this will allow DEL /Q to delete an entire
directory without prompting for confirmation.
DEL displays the amount of disk space recovered, unless the /Q option is
used (see below). It does so by comparing the amount of free disk space
before and after the DEL command is executed. This amount may be
incorrect if you are using a deletion tracking system which stores
deleted files in a hidden directory, or if another program performs a
file operation while the DEL command is executing.
Remember that DEL removes file descriptions along with files. Most
deletion tracking systems will not be able to save or recover a file's
description, even if they can save or recover the data in a file. This
applies to the use of DEL with the Windows Recycle Bin, too - the
description will be lost.
When a file is deleted without using the Recycle Bin, its disk space is
returned to the operating system for use by other files. However, the
contents of the file remain on the disk until they are overwritten by
another file. If you wish to obliterate a file or wipe its contents
clean, use the /W option, which overwrites the file before deleting it.
Use this option with caution! Once a file is obliterated, it is
impossible to recover. Remember: /W overrides using the Recycle Bin.
DEL returns a non-zero exit code if no files are deleted, or if another
error occurs. You can test this exit code with the %_? internal
variable, and use it with conditional commands (&& and ||).
Use caution when using wildcards with DEL on LFN drives, because TCC's
wildcard matching can match both short and long filenames. This can
delete files you did not expect; see LFN File Searches for additional
details.
DEL sets three internal variables:
%_del_dirs The number of directories deleted
%_del_files The number of files deleted
%_del_errors The number of errors
Recycle Bin
When you delete files with DEL, TCC does not move the deleted files to
the Windows Recycle Bin by default. You can change this default with the
Delete to Recycle Bin configuration option. If you have disabled the
recycle bin, you can override the setting and place deleted files in the
recycle bin with the /R option:
del /r letters.txt
If you have enabled Recycle Bin support, but want to override the
default setting on a one-time basis, and delete some files without
placing them in the recycle bin, use the /K option:
del /k letters.txt
You can also exclude files from the Recycle bin, even if Delete to
Recycle Bin is enabled, or if the command use the /R option, with the
RecycleExclude environment variable.
FTP Usage
If you have appropriate permissions, you can delete files on FTP
servers. For example:
del ftp://ftp.abc.com/index
You can also use the IFTP command to start an FTP session on a server
and then use one of the following syntax examples:
del ftp:path/*.txt
del ftp:/path/*.txt
The first syntax will normally be interpreted by the server as relative
to the path you specified when you used the IFTP command to start the
FTP session. The second syntax, with a slash before the path name, is
interpreted as starting from the root.
NTFS File Streams
DEL supports file streams on NTFS drives. You can delete an individual
stream by specifying the stream name, for example:
del streamfile:s1
If no stream name is specified the entire file is deleted, including all
streams.
See NTFS File Streams for additional details.
Options
/= Display the DEL command dialog to help you set the filename and
command line options. You cannot specify any other arguments on the
command line.
/A: Delete only those files that have the specified attribute(s)
set. See Attribute Switches for information on the attributes which can
follow /A:. Do not use /A: with @file lists. See @file lists for
details.
You can specify /A:= to display a dialog to help you set individual
attributes.
/B If DEL can't delete the file (for example, if access is denied)
it will schedule it to be deleted at the next reboot.
/E Suppress all non-fatal error messages, such as "File Not Found."
Fatal error messages, such as "Drive not ready," will still be
displayed. This option is most useful in batch files and aliases.
/F This option has the same effect as /Z (see below): it deletes
read-only, hidden, and system files as well as normal files.. It is
included for compatibility with CMD.
/I"text" Select filenames by matching text in their descriptions.
The text can include wildcards and extended wildcards. The search text
must be enclosed in double quotes, and must follow the /I immediately,
with no intervening spaces. You can select all filenames that have a
description with /I"[?]*", or all filenames that do not have a
description with /I"[]".
/K Physically delete files instead of sending them to the Windows
Recycle Bin.
/L Delete symlinks instead of their contents.
/N Do everything except actually delete the file(s). This is useful
for testing the result of a DEL.
A /N with one or more of the following arguments has an alternate
meaning:
d Skip hidden directories (when used with /S)
e Don't display errors
f Don't display the bytes freed in the summary
j Skip junctions (when used with /S)
n Don't update the file descriptions
s Don't display the summary
t Don't update the CD / CDD extended directory search database
(JPSTREE.IDX)
/O:... Sort the files before processing.
You may use any combination of the sorting options below. If multiple
options are used, the listing will be sorted with the first sort option
as the primary key, the next as the secondary key, and so on:
n Sort by filename and extension, unless e is explicitly included.
This is the default.
- Reverse the sort order for the next sort key
a Sort names and extensions in standard ASCII order, instead of
numerically when numeric substrings are included in the name or
extension.
d Sort by date and time (oldest first); also see /T:acw
e Sort by extension
g Group subdirectories first, then files
r Reverse the sort order for all options
s Sort by size
t Same as d
u Unsorted
/P Prompt the user to confirm each erasure. Your options at the
prompt are explained in detail under Page and File Prompts.
/Q Don't display filenames as they are deleted, or the number of
files deleted or bytes freed. If Prompt on Wildcard Deletes is disabled
then /Q also disables the normal confirmation prompt when performing
wildcard deletions (e.g. DEL *), for compatibility with CMD. Use caution
if you disable Prompt on Wildcard Deletes, as this will allow DEL /Q to
delete an entire directory without prompting for confirmation. See also
/T.
/R Delete files to the Windows Recycle Bin.
/S Delete the specified files in this directory and all of its
subdirectories. This is like a GLOBAL DEL, and can be used to delete all
the files in a subdirectory tree or even a whole disk. Do not use /S
with @file lists. See @file lists for details.
If you specify a number after the /S, DEL will limit the subdirectory
recursion to that number. For example, if you have a directory tree
"\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.
If you specify a + followed by a number after the /S, DEL will not
delete any files until it gets to that depth in the subdirectory tree.
For example, if you have a directory tree \a\b\c\d\e, /S+2 will not
delete anything in \a or \a\b.
/T Don't display filenames as they are deleted, but display the
total number of files deleted plus the amount of free disk space
recovered.
/W[n] Overwrite the file contents using the DoD 5220.22-M (E) standard
for secure deletion. (This overwrites every byte in the file with
different values). You can optionally specify the number of passes
(1-999); the default is 3. See also DelWipePasses. Use this option to
completely obliterate a file's contents from your disk. Once you have
used this option it is impossible to recover the file even if you are
using an undelete utility, because the contents of the file are
destroyed before it is deleted. /W will override a /R.
/X Removes empty subdirectories (only useful when used with /S). If
DEL deletes one or more directories, they will be removed automatically
from the extended directory search database. DEL will display the
directories being removed (with a trailing \).
/Y The reverse of /P . It assumes a Y response to everything,
including deleting an entire subdirectory tree. TCC normally prompts
before deleting files when the name consists only of wildcards or a
subdirectory name (see above); /Y overrides this protection and should
be used with extreme caution!
/Z Delete read-only, hidden, and system files as well as normal
files. Files with the read-only, hidden, or system attribute set are
normally protected from deletion; /Z overrides this protection, and
should be used with caution. Because EXCEPT works by hiding files, /Z
will override an EXCEPT command. However, files specified in a file
exclusion range will not be deleted by DEL /Z.
For example, to delete the entire subdirectory tree starting with
C:\UTIL, including hidden and read- only files, without prompting (use
this command with CAUTION!):
del /s /x /y /z c:\util\