Glindra
Documentation Index Download
Command Line File Handling and ASCII Tools

dele - Delete


Deletes one or more files.

Example (Windows)
> dele ***\*.html.* -before=yesterday
Deleted:   e:\work\about.html
Deleted:   e:\work\index.html
Deleted:   e:\work\doc\00readme.html.~1~
Deleted:   e:\work\doc\00readme.html.~2~
Deleted:   e:\work\doc\00readme.html
Deleted:   e:\work\doc\old\index.html
  26 kb deleted, 6 files
Example (Linux)
> dele '***/*.html.*' -before=yesterday
Deleted:   \home\chris\work\about.html
Deleted:   \home\chris\work\index.html
Deleted:   \home\chris\work\doc\00readme.html.~1~
Deleted:   \home\chris\work\doc\00readme.html.~2~
Deleted:   \home\chris\work\doc\00readme.html
Deleted:   \home\chris\work\doc\old\index.html
  26 kb deleted, 6 files

Parameters

Input File Specification

Example
> dele '*.tmp.*'


The dele command takes one or more filenames, with or without wildcards, as parameter. dele accepts the same wildcards as the d directory command. See File Specifications.

Filenames that contain wildcard characters must be placed within single quotes under Linux.

Version number is required

With dele you must always specify an explicitly which version(s) you want to delete. The version number can be either of the following:

.* Delete all versions of all file(s). This would be the most common case.
.
Delete only the highest version of the file(s). This will normally be the version that does not have any version number at all, but it could also be the file with the highest explicit version number, if no unversioned file exists.

Deleting the highest version of a file is useful when you want to revert to the previous version of it (provided that version still exists and has not been purged away).

.3
A positive version number signifying a particular version of the file. The tildes that appear on either side of the number in the filename on disk can be left out when typing the file specification.
.-1
A negative version number signifying the relative version of the file. .-1 means the second highest version of the file, etc.

No default wildcards

Unlike the d directory command, dele does not add any defaults to the input file specification, so you must specify all wildcards explicitly.

Together with the fact that an explicit version number is required, dele is less generous with the syntax than any of the other basic file handling commands. The intention is of course to make it more difficult to accidentally delete the wrong files.

Wildcards to use with dele:
*.*.* All versions of all files in the directory.
*.*.
The highest version of all files in the directory, but not the previous versions. The trailing dot it required.
*.
The highest version of all files in the directory that have an empty extension.
*..*
*.~*~
All versions of all files in the directory that have an empty extension.

If you use the syntax with only one dot, the tildes are required, or you will get the error message "Version number must be explicit of wildcard".


Deleting directories

Directory files can be deleted just like any other files, provided they are empty.

Just like for regular files, the dele command requires that the version number field is specified explicitly in the command line. Since directory files normally have neither extension nor version number, this means that you should add a dot after the directory name if you want to delete it with the dele command.

Example
> dele mydir.
Deleted:   e:\work\mydir
  0 byte deleted, 1 file


Deleting directory trees
To delete a directory that has files in it, you first have to delete the files so that the directory becomes empty. This is done with the command
> dele -hidden 'mydir/***/*.*.*'
The -hidden option is required to make sure any hidden files in the directory tree are deleted as well.

The dele command will delete the files in "bottom up" order. This ensures that subdirectories that become empty as a result of the command, can themselves be deleted by it. (VMS did not do it this way, which meant that you had to repeat the same command several times in order to delete an entire directory tree.)

When the directory is empty, you can delete the directory itself with the command

> dele mydir.


Alternatively, you can combine the two into a single delete command:

> dele -hidden mydir. 'mydir/***/*.*.*'
This will first delete the contents of mydir, and then mydir itself.


The command

> dele -hidden ***\*.*.*

will delete all files in the current directory and in all subdirectories, including the subdirectories themselves.

Warning! Do not confuse dele with del

The Windows command del is similar to dele, and it can be easy to mistype one for the other. This presents a potential hazard, as the two commands accept a similar syntax, but there are semantic differences as to which files should be deleted in some cases.

In practice, the situation is not quite as bad as it sounds, however.

The Glindra dele command demands that each file specification should contain a second dot followed by something that can be interpreted as an explicit version number. The Windows del command has no such requirement, so most command lines that you would want to give to the Windows command del will not be accepted by dele because the version number is missing, and vice versa.


The only practical danger that I am aware of is the following:

dele a.xyz.~*~
The Glindra command deletes all versions of the file, including the last one.
del a.xyz.~*~ The Windows built-in command deletes all versions except the current one of the file.

If you were using the Windows del command to remove all obsolete versions of a file, but leave the most current one in place, the latter command would unfortunately be the normal way to do this. This means that if you have developed the habit of using del in this manner, and accidentally mistype the command so that you type dele instead of del, you would delete both the old versions and the most current version of the file.

For this reason, it is strongly recommended that you avoid using the Windows command del to delete obsolete file versions.

To delete all versions except the last one, you should use the Glindra command pu (purge) instead.


Options

-sure

Option
Suppress the "Are you sure?" confirmation question for directory specifications that start with \***\. The option name cannot be abbreviated.
Example (Windows)
> dele \***\old\junk\rubbish.tmp.-1 -sure


What's the problem?

If you intend to delete all files and subdirectories in the current directory with the command

> dele ***\*.*.*

but accidentally insert an extra \ at the beginning, so that the command becomes

> dele \***\*.*.*

you would wipe out the entire directory structure and all the files in it.

Confirmation question

To safeguard against this potential mistake, the dele and pu commands will demand confirmation if you give a file specification that begins with the wildcard \***\.

They will do this both if the \***\ wildcard is just the beginning of a more specific directory path, and if it is the entire directory specification.

Example (Windows)
> dele \***\*.*.*
Delete files across the entire directory structure. Are you sure? N
No files deleted

> dele \***\old\junk\rubbish.tmp.-1
Delete files across the entire directory structure. Are you sure? Y
Deleted: e:\alice\wombat\old\junk\rubbish.tmp.~2~
Deleted: e:\old\junk\rubbish.tmp.~9~
1.4 Gb deleted, 2 files


Suppressing the question with -sure

If you are sure that you do indeed want to use the directory wildcard starting from the top directory, and you do not want the command to ask for confirmation, you can suppress the question by adding the option -sure to the command line.

The option cannot be abbreviated and must be spelled out in full.

Example (Windows)
> dele \***\old\junk\rubbish.tmp.-1 -sure
Deleted: e:\alice\wombat\old\junk\rubbish.tmp.~2~
Deleted: e:\old\junk\rubbish.tmp.~9~
1.4 Gb deleted, 2 files

File Selection Options

Example (Windows)
> dele ***\*.*.* -exclude=(.doc .txt) -before=today -min_size=2mb -hidden
Example (Linux)
> dele '***/*.*.*' -exclude=\(.doc .txt\) -before=today -min_size=2mb -hidden
Options
-since [= datetime] Select files that were created on or after a certain date/time.
-before [= datetime] Select file that were created before a certain date/time.
-min_size [= size] Specify a minimum file size in bytes, Mb, or some other unit
-max_size [= size] Specify a maximum file size .
-directories [= only/also/not]
List directory files (only/also/not) . Default is also.
-hidden [= only/also/not] List hidden files (only/also/not). Default is not.
-nodefault Has no effect, since dele does not add any defaults to the file specification anyway.
-exclude [= filespec] Exclude files that match the file specification given as option value. If the option value is enclosed in parenthesis, it can contain a full file specification, including recursive file selection options.

These options control which files are selected. See File Selection Options for more information.

Help and Information Options

Example (Windows)
> dele *.log.* -nowarning
Example (Linux)
> dele '*.log.*' -nowarning
Options
-help   -h   -?
Print out a brief help text with a summary of each of the different options, and exit from the program.
-version Show the name and version number of the program, and exit. This option must be written out in full, and cannot be abbreviated.
-verbose   -v
-statistics
-noverbose
Specify the amount of informational messages.
-warning
-nowarning
-noerror
Specify the level of error reporting.

See Help and Information Options.