Glindra
Documentation Index Download
Command Line File Handling and ASCII Tools

pu - Purge


Deletes obsolete versions of files, leaving just the most current version(s).

The most current version of a file will normally be without any version number in its filename, but pu will make sure that the highest version of the file remains even if it does have an explicit version number.

Example (Windows)

Suppose we have the following .html files in a directory:

Directory of e:\work\

2 kb 23-Sep-2004 11:35:27 functions.html.~1~
17 kb 15-Feb-2005 16:53:04 functions.html.~2~
11 kb 17-Feb-2005 20:55:40 functions.html.~3~
11 kb 17-Feb-2005 20:56:53 functions.html
7 kb 16-Feb-2005 18:45:23 index.html
14 kb 15-Feb-2005 16:53:35 procedures.html.~1~
15 kb 15-Feb-2005 18:37:26 procedures.html.~2~
----------
76 kb total, 7 files


By giving the command

> pu *.html
Deleted: e:\work\functions.html.~3~
Deleted: e:\work\functions.html.~2~
Deleted: e:\work\functions.html.~1~
Deleted: e:\work\procedures.html.~1~
44 kb purged, 4 files


we get

Directory of e:\work\

11 kb 17-Feb-2005 20:56:53 functions.html
7 kb 16-Feb-2005 18:45:23 index.html
15 kb 15-Feb-2005 18:37:26 procedures.html.~2~
----------
33 kb total, 3 files

Parameters

Input File Specification

Example (Windows)
> pu ***\*.html
Example (Linux)
> pu '***/*.html'


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

Version number is not allowed

The file specification for pu must not contain any version number, since specifying a particular version of a file would not be meaningful in this context.

Default is *.*
If you just give a directory name to the pu command, it will purge all files in that directory, so that only the most current version of each file remains.

The command

> pu mydir
has the same meaning as
> pu 'mydir/*.*'


If you omit the parameter completely, the command

> pu
will purge all files in the current directory, and has the same meaning as
> pu '*.*'


The command to purge all files in the current directory and all its subdirectories is

> pu ***


You can also specify a filename, or part of one, to purge only certain files in the directory or directories. For example, the command

> d pu x17
purges the files x17.* in the current directory, as the .* extension wildcard is added automatically.


The command

> d pu '***/*.xyz'
purges all files with the extension .xyz in the current directory and all its all subdirectories.


Wildcards to use with pu:
nothing
*
*.*
The default, if you specify no filename and no extension, is to purge all files in the directory or directories. You can also get the same result by specifying the filename as either * or *.*
.* -hidden All files that start with a dot.

Under Linux, you must remember to add the option -hidden, since files that start with a dot are considered hidden on this platform, and will not be purged otherwise.

The -hidden option is normally not required to purge files that start with a dot under Windows.

*.
All files that have an empty extension. The trailing dot is required to signal the empty extension.


Options

-sure

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

See Delete Command: -sure.


-keep = n

Specifies how many versions to keep of each file. Default is 1, which means that only the most current version will be kept.

Example
> pu index.html -keep=2
Deleted: e:\work\index.html.~3~
Deleted: e:\work\index.html.~2~
Deleted: e:\work\index.html.~1~

> d index.html

Directory of e:\work\

12 kb 17-Feb-2005 14:15:40 index.html.~4~
15 kb 17-Feb-2005 14:41:50 index.html
----------
27 kb total, 2 files


File Selection Options

Example (Windows)
> pu ***\*.* -exclude=(.doc .txt) -hidden
Example (Linux)
> pu '***/*.*' -exclude=\(.doc .txt\) -hidden
Options
-directories [= only/also/not]
List directory files (only/also/not) . The default is not, since the operation is not really meaningful on directory files.

Note that the default is different for pu than it is for the other basic file handling commands.

-hidden [= only/also/not] List hidden files (only/also/not). Default is not.
-nodefault Has no effect, since pu 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)
> pu *.log -nowarning
Example (Linux)
> pu '*.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.