FileUtils plugin for Take Command / TCC / TCC/LE

beta version 0.39.4.1     2024-04-03

Charles Dye

Purpose:

This plugin adds a few file- and drive-related features. BOTTOMUP visits directories recursively, from innermost to outermost, and runs a command in each — like an inside-out GLOBAL. BSPLIT splits files into smaller files. DIRCMP compares two directories and list items which appear in one but not the other. It can optionally also compare files’ sizes, time stamps, attributes, and contents. EMPTIES lists, and optionally removes, empty subdirectories. FILEINFO displays lots of information about matching files, including checksums, version information, image file information, and Windows properties. RENCASE changes the case of filenames. SWAPNAMES exchanges two files.

@IMGINFO returns information about an image file. @RPTARGET returns the target of a reparse point. @WINPROP returns a Windows property of a file.

Installation:

To use this plugin, copy FileUtils.dll and FileUtils.chm to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take FileUtils-x32.dll instead of FileUtils.dll.) Load the .DLL file with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\fileutils.dll

If you copy these files to a subdirectory named PlugIns within your Take Command program directory, the plugin will be loaded automatically when TCC starts.

Plugin Features:

New commands:
APPPATHSBOTTOMUPBSPLITDIRCMPEMPTIES
FILEINFOFILEUTILSHELPRENCASESWAPNAMES
New functions:
@CMPTIME@CMPVER@DDEPTH@DIREMPTY@DIRREADABLE
@DIRWRITABLE@DRIVEBUS@FILEVER@FINDDRIVE@IMGINFO
@ISABATCH@RANDFILE@RPTARGET@WINPROP
New variables:
_FWDRIVES_K32VER_USBDRIVES

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

New Commands:

APPPATHS — List, set, or remove AppPaths entries.

Syntax:
APPPATHS /D:dir /E /K /M /N:flags /P /Q /R:file /U /X /Y app.exe=fullpath

/D:dirspecify the default directory for app.exe
/Esuppress error messages
/Kshow counts
/Min HKEY_LOCAL_MACHINE (system-wide)
/N:flagsdisable features:
    C — disable highlight
    E — suppress error messages
    H — don’t show hive tags
    W — don’t check existence of files and directories
/Ppage output
/Qquietly
/R:fileread entries from a text file
/Uin HKEY_CURRENT_USER (per-user)
/Xexpand REG_EXPAND_SZ values
/Yyes to all prompts
app.exethe program to list/set/delete an entry for
fullpaththe complete pathname to the .EXE file

Any options must come before any app.exe on the command line.

This command can be used in four different ways: to list existing AppPaths entries, to create or change an entry, to remove an AppPaths entry, or to read and set entries from a file. Different options make sense in each of these modes.


To list AppPaths entries:

APPPATHS /K /M /P /U /X app.exe

The app.exe should end in .EXE; it may contain wildcards. If you do not specify an app.exe, APPPATHS will list all entries. If you do not specify either /M or /U, the default is to list entries from both keys.


To set an AppPaths entry:

APPPATHS /D:dir /E /M /Q /U /X /Y app.exe=fullpath

app.exe is required; it should end in .EXE. If you do not specify either /M or /U, the default is /M.

If you do not specify a /D:dir, the default is the program’s directory from fullpath.

Strings are written as type REG_SZ, unless you specify /X. With /X, if either your fullpath or your /D:dir contains at least one percent sign, then the string(s) with percent signs will be written as type REG_EXPAND_SZ.


To remove an AppPaths entry:

APPPATHS /E /M /Q /U /Y app.exe=

app.exe is required; it should end in .EXE. If you do not specify either /M or /U, the default is /M.


To read and set AppPaths entries from a file:

APPPATHS /E /M /Q /R:file /U /X /Y

The file should contain one entry per line, in the format:

app1.exe = fullname1
app2.exe = fullname2
app3.exe = fullname3

Blank lines and lines beginning with a semicolon are ignored. All other lines must be in app.exe=fullname format, or they will be flagged as errors.

When setting entries from a file, no attempt is made to canonicalize file and directory names, or to check whether they actually exist. Filenames are simply written to the registry as is.

All entries will be made in the same registry hive, according to /M or /U; if neither is specified, the default is /M. There is no provision for specifying default directories; the default directory for each entry will be fullname’s directory.

Strings are written as type REG_SZ, unless you specify /X. With /X, strings containing percent signs will be written as REG_EXPAND_SZ; strings without percent signs will still be created as REG_SZ.



BOTTOMUP — Visit subdirectories recursively, deepest first, and run a command in each.

Syntax:
BOTTOMUP /B /H /I /N /P /Q /S:dir command

/Bbare directory display
/Hinclude hidden directories
/Iignore exit codes
/Ndo not visit or search junctions
/Pprompt before running the command
/Qdo not display directory names
/S:dirspecify the top-level directory

This command works much like GLOBAL, only inside-out. It visits subdirectories recusively, deepest first, and runs the specified command in each. It ends up — and runs the command a final time — in the original current directory.

TCC expands the command line before BOTTOMUP sees it. You will need to double any percent signs, and use escapes or strong quotes to protect any problem characters in the command. This is different than GLOBAL, but unavoidable — I cannot prevent TCC from performing variable expansion before the plugin command is called.

The command is required. If you want to do nothing recursively, use REM.

By default, BOTTOMUP will abort if the command returns a nonzero exit code, or if it cannot change the current directory to any subdirectory in the tree. If /I is specified, both of these situations will be ignored and processing will continue.


rem    Trivial demo:
bottomup /q echo Now I'm in "%%_cwd" !

rem    An inside-out directory listing:
bottomup /i /q dir /f /h /ne



BSPLIT — Split files into smaller files.

Syntax:
BSPLIT /D:dir /E /F:n /N:n /O /P /Q /S:size /X:prefix filename…

/D:diroutput directory
/Eno error messages
/F:nextension numbering format
/N:nnumber of splits
/Ooverwrite existing files
/Poutput to source file’s path
/Qquietly
/S:sizesplit size
/X:prefixextension prefix
filename…files to split

BSPLIT divides a file into multiple smaller files. You can split at a specified size (/S:), or into a specified number of files (/N:). You cannot combine /N: and /S:.

You must supply a filename. Wildcards and directory aliases are supported, and you may have more than one filename on the command line. The output directory defaults to the current directory.

BSPLIT is short for “binary split”. It splits files by byte size. It does not support splitting by lines or characters. If the input file contains text it may be divided within a line, or possibly even within a character.


/D:dir specifies the directory that the split files will be written to. If this directory does not exist, BSPLIT will attempt to create it for you.

/P writes the split files to the same directory as the original file. It’s like a shorthand for /D:"%@PATH[filename]". If you don’t specify either /D: or /P, the default is to write the split files to the current directory.


/F:n lets you change the way the output files are numbered. The formats are:

0two decimal digits
1three decimal digits
2four decimal digits
3two hexadecimal digits
4three hexadecimal digits
5four hexadecimal digits
6two letters (base-26)
7three letters (base-26)
8four letters (base-26)

Add 32 for uppercase. If you don’t specify a format, the default is three decimal digits. If you specify a prefix with /X:, the prefix will be inserted at the start of the extension.


/S:size specifies the size of the output files. You may give the size as:

nbytes
nkthousands of bytes
nKkilobytes (1,024 bytes)
nmmillions of bytes
nMmegabytes (1,048,576 bytes)
ngbillions of bytes
nGgigabytes (1,073,741,824 bytes)

/N:n instead splits the file into n more-or-less equally-sized pieces. You cannot combine /N: and /S:.


rem    Break BigFile into 500-kilobyte files:
bsplit /s:500K bigfile

rem    Break BigFile into four more-or-less equal files:
bsplit /n:4 bigfile



DIRCMP — Compare two directories.

Syntax:
DIRCMP /A /C /D /M /P /R /S /T /X dir1 dir2

/Acompare attributes of items which exist in both dir1 and dir2
/Ccompare file contents
/Ddisable highlight
/Mdo not display the footers
/Ppage output
/Rcompare directories recursively
/Scompare sizes of files which exist in both directories
/Tcompare time stamps of files which exist in both directories
/Xreverse operation — reports only items which exist in both directories
dir1the first directory; directory aliases are supported
dir2the second directory; directory aliases are supported

dir1 and dir2 are both required. Wildcards are not allowed; you must name two unambiguous directories.

/A compares attributes when a file or subdirectory exists in both dir1 and dir2. Only the read-only, archive, hidden, and system attributes are compared. The more exotic attributes will be ignored.

/C compares the contents of files which appear in both directories. Both files are opened, then data is read and compared, byte-for-byte. This option can slow DIRCMP down considerably! If the command is unable to read from either file, the files are considered the same.

/S compares file sizes when a file exists in both locations. Only files are tested. The relevant Windows APIs do not report sizes for subdirectories.

/T compares time stamps when a file exists in both locations. Only the last-write time stamp is compared, and the comparison is fuzzy; differences of less than two seconds may be ignored. Only time stamps of files are compared; this option does not test subdirectories.

/X reverses DIRCMP’s operation and reports only items which exist in both locations. If you combine /X with /A, /C, etc. then only items with matching attributes, contents, and so on will be listed.

Note that /R, not /S, controls recursion. Recursion is only performed where subdirectories with the exact same name exist in both dir1 and dir2.

Mismatches are reported with a note in brackets:

[1]The item exists in dir1 but not in dir2.
[2]The item exists in dir2 but not in dir1.
[A]The item has different attributes in dir1 and dir2.
[C]The file has different contents in dir1 and dir2.
[S]The file has different sizes in dir1 and dir2.
[T]The item has different time stamps in dir1 and dir2.

The letters may be combined; e.g. [ST] would mean that the items have different sizes and time stamps.

Items which exist in one directory, but not the other, are always reported. There is no option to suppress this feature.

If a file exists in dir1 and a subdirectory of the same name exists in dir2 — or vice versa — then both will be reported as mismatches.


dircmp /r /s "%userprofile\Documents" d:\backup\docs\



EMPTIES — List or remove empty subdirectories.

Syntax:
EMPTIES /J /M /P /Q /R /Y dirname…

/Jallow recursion into reparse points
/Mno footers
/Ppage output
/Qquietly (only useful with /R)
/Rremove empty directories
/Yyes to all prompts
dirname…directory aliases are supported

If no directory names are given, EMPTIES searches the current directory by default.

See also: the @DIREMPTY function.



FILEINFO — Display information about files.

Syntax:
FILEINFO /A:attribs /C:hash /D /N:flags /O:flags /P /S /T:flags /[range] file…

/A:attribsfilter by attributes
/C:hashchecksum and hash algorithms; see below
/Ddisable highlight
/N:flagsdisable features; see below
/O:flagsomit features; see below
/Ppage output
/Slook in subdirectories for matching files
/T:modetime display mode; see below
/[range]many range options are supported
filewildcards, directory aliases, include lists, and @file lists are supported

FILEINFO displays information about files; go figure. By default, the information shown includes the full, canonical filename; any version information; any TCC file description; the file size, date and time stamps, and attributes; CRC32 and MD5 checksums; 4DOS file descriptions; executable types; Windows properties; and document summary information.


/N: disables features. These flags can be combined:

Cdisable highlight
Ddo not search into hidden directories
Fsuppress file-not-found errors
Jdo not search into junctions
Zdo not search into system directories

/O: omits classes of information. These flags can be combined:

Aomit attributes
Comit checksums
Domit file descriptions
Eomit text file encoding
Homit file version header
Iomit image file info
Lomit link targets
Pomit Windows properties
Somit document summary information
Tomit time stamps
Vomit version information
Xomit executable information
Zomit sizes

Omitting information can make the command faster and reduce the amount of text that is displayed. In particular, computing checksums for very large files can be slow; using /OC will save this time.


/C: specifies the type of checksum or hash displayed by FILEINFO. The available algorithms are:

CRC32CKSUMMD5
SHA1SHA256SHA384
SHA512

You can give more than one, separated by commas. If no /C: is given, the default is /C:CRC32,MD5.


/T: selects which time stamps to display, and how to show them. Flags may include:

Ashow the last-access time stamp
Cshow the creation time stamp
Mshow the last-modified time stamp
Ddefault: localize time stamps as TCC and CMD.EXE do
Llocal times, taking DST time changes into account
UCoordinated Universal Time

A, C, and M may be combined. If none is given, the default is to display all three time stamps. Only one of D, L, and U should be given; the default is D.


fileinfo "%_cmdspec"



FILEUTILSHELP — Open the FileUtils plugin help file.

Syntax:
FILEUTILSHELP /C /F /S /S:text /V topic

/Cselect the ‘Contents’ tab
/Fselect the ‘Favorites’ tab
/Sselect the ‘Search’ tab
/S:textselect the ‘Search’ tab and search for text
/Vshow detailed plugin version info
topicthe page to display

The FILEUTILSHELP command will locate and open this plugin’s help file. In most cases, the internal HELP command, and the F1 and Ctrl-F1 keys, will be more convenient. The main advantage to this command is that it can be used to open the help file to any desired topic, not only to the names of commands, functions, and variables.


Note that any /C /F or /S must precede any topic on the command line. (This command has a very simple-minded parser.)



RENCASE — Change the case of filenames.

Syntax:
RENCASE /A:attribs /E /L /N /N:flags /S /U /W /X:luw /[range] file…

/A:attribsfilter by attributes
/Eno error messages
/Lchange the base name (all but the extension) to lowercase
/Nnot really
/N:flagsD no hidden directories, J no junctions, Z no system directories
/Slook in subdirectories for matching files
/Uchange the base name (all but the extension) to uppercase
/Wchange the base name (all but the extension) to word case
/X:luwchange the extension to upper/lower/word case
/[range]many range options are supported
file…wildcards, directory aliases, etc. supported

RENCASE renames files, changing the case of letters. Filenames are handled as two parts: the base name (everything before the last period), and the extension (everything after). Options /L, /U, and /W affect the base name, and /X: affects the extension.

If no action is specified (none of /L, /U, /W, or /X:), the default is /L.

rencase /l /x:l *.html



SWAPNAMES — Exchange two files.

Syntax:
SWAPNAMES /D /Q /X file1 file2

/Dfile1 and file2 are directories, not files
/Qquietly
/Xcheck that file1 and file2 have the same file type
file1, file2required; wildcards not allowed

This command does a double rename. It renames file1 as file2, and vice versa. It only renames one pair of files; wildcards are not supported.

/X gets both files’ extensions, and reads their default handlers from the registry. It allows the rename only if both extensions are the same, or if both have the same handler. For example, you can swap a .txt file with a .log file only if they have the same handler. /X is ignored with /D.

swapnames myfile.cpp myfile.bak



New Functions:

@CMPTIME — Compares timestamps of two files.

Syntax:
%@CMPTIME[file1,file2,which]

file1the first file to examine
file2the second file to examine
whichA, C, or W; the default is W

Both files must exist. Directory aliases are supported.

Return values:

-1if file1 is older than file2,
0if both files are the same age,
1if file1 is newer than file2.

if %@cmpfile[%_cmdspec,%_ininame] == 1 echo %_cmdspec is newer than %_ininame!



@CMPVER — Compares version numbers of two files.

Syntax:
%@CMPVER[file1,file2,flags]

file1the first file to examine
file2the second file to examine
flags1: do not assume 0.0.0.0

Both files must exist. Directory aliases are supported. If either file does not contain version information, this function will assume 0.0.0.0 — unless flags is 1, in which case the function will give an error instead.

Return values:

-1if file1 has a lower version number than file2,
0if both files are the same version,
1if file1 has a higher version number than file2.

echo %@cmpver[%@search[notepad.exe],%@search[ping.exe]]



@DDEPTH — Returns the depth of a file or subdirectory.

Syntax:
@DDEPTH[file]

filedirectory aliases and relative paths are okay

Returns 0 for items in the root directory, 1 for items in a subdirectory, 2 for items in a sub-subdirectory, and so on. File need not actually exist.

echo %@ddepth[c:\foo\bar\readme.txt]



@DIREMPTY — Checks whether a directory is empty.

Syntax:
@DIREMPTY[dirname]

dirnamethe directory to check

If dirname is a directory and it is empty, @DIRNAME returns 1. If dirname is not a directory, if it isn’t readable, or if it contains anything other than . and .., then @DIRNAME returns 0.

See also: the EMPTIES command.



@DIRREADABLE — Tests whether the current user can read from a directory.

Syntax:
@DIRREADABLE[dirname]

dirnamethe directory to test

Returns 1 if you can read from the specified directory, 0 if not.

See also: the @DIRWRITABLE function.



@DIRWRITABLE — Tests whether the current user can write a directory.

Syntax:
@DIRWRITABLE[dirname]

dirnamethe directory to test

Returns 1 if you can write to the specified directory, 0 if not.

See also: the @DIRREADABLE function.



@DRIVEBUS — Returns the bus type of a given local drive.

Syntax:
%@DRIVEBUS[drive]

drivethe drive letter; the colon is optional

@DRIVEBUS returns an integer bus type: 4 IEEE 1394, 7 USB, etc.



@FILEVER — Returns the version number of a file.

Syntax:
%@FILEVER[file,flags]

filethe first file to examine
flags1: do not assume 0.0.0.0

File must exist. Directory aliases are supported. The version number will be returned in the format major.minor.build.private. If the file does not contain version information, the return value will be 0.0.0.0 — unless flags is 1, in which case the function will give an error instead.

This value is always four integers, separated by periods (not your local decimal character) and without leading zeroes or spaces. It’s a more consistent format than the version strings returned by @VERINFO, which may contain whatever the programmer fancies.

echo %@filever[%_cmdspec]



@FINDDRIVE — Finds a drive matching the given criteria.

Syntax:
%@FINDDRIVE[label,serial,minsize,maxsize,bus]

labelwildcards are supported
serialup to 8 hex digits
minsizesuffixes k, K, m, M, etc. supported
maxsizesuffixes k, K, m, M, etc. supported
bus4 IEEE 1394, 7 USB, etc.

@FINDDRIVE returns the drive letter (with a colon) of the first drive it finds which meets all of the specified criteria. You must specify at least one.



@IMGINFO — Returns information about an image file.

Syntax:
%@IMGINFO[n,filename]

nwhich information to return; see below
filenamethe image file to examine

If filename does not exist, is not an image file, or cannot be read, you’ll get an error message. If you request EXIF data which is not present in the file, @IMGINFO will return the string N/A.


n:Returns:
0image resolution, width × height
1image width (pixels)
2image height (pixels)
3horizontal resolution (DPI)
4vertical resolution (DPI)
5bits per pixel
6image format (string)
EXIF data:
10image orientation
11date and time
12date and time (original)
13date and time (digitized)
14author
15description
16copyright
17software
18camera make
19camera model


@ISABATCH — Looks for a matching batch file.

Syntax:
%@ISABATCH[file,path,flags]

filethe command to search for; no path, no extension, no wildcards
pathdirectories to search; defaults to %PATH
flagsbitmapped: 1: search current dir before path; 2: also search AppPaths; 128: return filename

@ISABATCH searches for a matching command, and returns a numeric value:

0no matching command was found
0the first matching command is not a batch (.com or .exe)
1the first matching command is a .btm
2the first matching command is a .cmd
3the first matching command is a .bat

The flags value lets you alter the function’s operation:

1search the current directory before the search path
2search AppPaths after the search path
128return the first matching filename, not a numeric value

If flags is not specified, it defaults to 1.

You can specify a different list of directories to search with path. Separate directories with semicolons (not commas!) and quote any directory which contains a space, comma, semicolon, or other troublesome character.


iff %@isabatch[empire] == 0 then
    echo Empire is not a batch file.
else
    echo Empire is a batch file:  %@isabatch[empire,,128]
endiff



@RANDFILE — Picks a file at random and returns its filename.

Syntax:
%@RANDFILE[/A:attribs /S /[range] wildspec]

wildspecrequired; directory aliases are supported
/A:attribsfilter by attributes; use /A:D to find subdirectories instead of files
/Ssearch for matching files in subdirectories
/[range]many range options are supported
wildspecrequired; directory aliases are supported

@RANDFILE makes a list of files matching the given wildspec, picks one at random, and returns a complete pathname. If no files match the wildspec, this function returns an empty string.

•  Note: Enumerating all matching files can take a long time, especially if you use /S.



@RPTARGET — Returns the target of a reparse point.

Syntax:
%@RPTARGET[filename]

filenamethe reparse point to examine

This function effectively combines the capabilities of @JUNCTION and @SYMLINK. Currently symlinks (relative and absolute), junctions, and AppX execution aliases are supported. No wildcards, directory aliases, or other funny stuff. @RPTARGET only takes one argument. There is no need to quote it, though you can if you want to.

echo %@rptarget[%userprofile\start menu]



@WINPROP — Returns a Windows property for a file.

Syntax:
%@WINPROP[n,filename]

nwhich property to return
filenamethe file to examine

If filename does not exist, you’ll get an error message. If the file cannot be read or the specified property does not exist, @WINPROP will return an empty string.

nReturns:
Core properties
0System.Author
1System.Comment
2System.Copyright
3System.FileDescription
4System.FileVersion
5System.ItemAuthors
6System.ItemNameDisplay
7System.Keywords
8System.Rating
9System.Subject
10System.Title
11System.Trademarks
Media properties
20System.Media.AuthorUrl
21System.Media.CreatorApplication
22System.Media.CreatorApplicationVersion
23System.Media.DateEncoded
24System.Media.DateReleased
25System.Media.Duration
26System.Media.Producer
27System.Media.Publisher
28System.Media.SubTitle
29System.Media.Year
Music properties
40System.Music.AlbumArtist
41System.Music.AlbumID
42System.Music.AlbumTitle
43System.Music.Artist
44System.Music.Composer
45System.Music.Conductor
46System.Music.DisplayArtist
47System.Music.Genre
48System.Music.Mood
49System.Music.Period
50System.Music.TrackNumber
Audio properties
60System.Audio.ChannelCount
62System.Audio.EncodingBitrate
66System.Audio.SampleRate
67System.Audio.SampleSize


New Variables:

_FWDRIVES — Returns a list of drives connected to IEEE 1394 ports.

Syntax:
%_FWDRIVES

If more than one drive is returned, they will be separated with spaces.

for %drive in ( %_fwdrives ) do vol %_drive



_K32VER — Returns the version number of Kernel32.dll.

Syntax:
%_K32VER

This convenience function is equivalent to @FILEVER[%_winsysdir\Kernel32.dll]. You can use it as an alternate way to get the Windows version. The value will be returned as four decimal values, separated by periods, without spaces or leading zeroes.



_USBDRIVES — Returns a list of drives connected to USB ports.

Syntax:
%_USBDRIVES

If more than one drive is returned, they will be separated with spaces.

for %drive in ( %_usbdrives ) do vol %_drive



Reference Information:


Paging OptionsSupported in several commands.
Range OptionsSupported in several commands.
The Highlight VariableChoose your colors.
Startup MessageAnd how to suppress it.
Status and Licensing

Paging Options:

Many of the commands in this plugin have a /P option to page output. This option supports two suboptions:

/P:time,lines

timetime in seconds, or (with a trailing M) milliseconds
linesnumber of lines to display before pausing

Both time and lines are optional. The colon is not required, but you must use the comma if you want to specify lines.

rem  Scroll every ten seconds:
type /p:10 myfile.txt

rem  Display ten lines at a time:
type /p:,10 myfile.txt

rem  Display twenty lines at a time, and
rem    scroll every 2.5 seconds:
type /p:2500m,20


At the “Press a key to continue” prompt, most keys will advance by another screenful (or lines). But a few keys behave differently:

A or Cturns off paging, and scrolls continuously
Esc or Ctrl-Caborts the current command
/scrolls half a screen, or half of lines
1 to 9scrolls that many lines, e.g. 3 scrolls three lines

Ranges:

This plugin supports the following range syntax:


Size range:  /[Ssmallest,largest]

You may omit either smallest or largest. You may qualify either with a trailing letter: lowercase k, m, g, etc. to multiply by one thousand, one million, one billion, and so on; or uppercase K, M, G, etc. to multiply by 210, 220, 230, and so on. If largest begins with a + sign, it is an increment over smallest. Use /![Ssmallest,largest] to invert the test and return only files not in the given size range.

Date range:  /[D[acw]:earliest,latest]

You may omit either earliest or latest; either defaults to the current date. The optional [acw] argument selects the date stamp to check. (If you want to check more than one date stamp, you must supply more than one date range option.) The colon after the [acw] is optional.

Dates may be given in the local date format, or in yyyy-mm-dd format (with a four-digit year). You may also specify a date as an offset preceded with a + or - sign; the offset is in days relative to today’s date (for earliest) or relative to earliest (in the case of latest). If earliest turns out to be later than latest then the two are exchanged.

You may also give a specific time on either date, preceded by an @ sign. The time may be in either 24-hour format, or 12-hour format with a trailing A or P.

Use /![D[acw]:earliest,latest] to invert the test and return only files not in the given date range.

Time range:  /[T[acw]:earliest,latest]

You may omit either earliest or latest. The optional [acw] argument selects the time stamp to check. (If you want to check more than one time stamp, you must supply more than one time range option.) The colon after the [acw] is optional. Times may be in either 24-hour format, or 12-hour format with a trailing A or P.

Use /![T[acw]:earliest,latest] to invert the test and return only files not in the given time range.

Exclusion range:  /[!wildspec]

Filenames matching the wildspec will be excluded. You can supply more than one wildspec by separating them with (unquoted) spaces.

Owner range:  /[Owildspec]

Files whose owners (in domain\user format) do not match the wildspec will be skipped. Use /![Owildspec] to invert the test and return only files which do not match the owner wildspec.

Description range:  /Iwildspec or (alternate syntax) /[Iwildspec]

If a file’s description does not match the wildspec, it will be skipped. Use /!Iwildspec to invert the test, returning only files which do not match the description wildspec.

Day-of-the-week range:  /[W[acw]:days]

You may specify multiple days separated by commas, e.g. /[W:MON,WED,FRI]. You can also give a range, for example /[W:TUE-FRI]. WEEKENDS is accepted as a synonym for SAT,SUN; WEEKDAYS is a synonym for MON-FRI. The colon in this syntax is required.

You may supply multiple ranges. A file must match all given ranges or it will be skipped.

Highlight Variable:

A few of the commands in this plugin feature highlighted output. You can customize this feature by setting an environment variable Highlight:

rem  Disable highlight:
set highlight=none

rem  Set the highlight foreground:
set highlight=bright cyan

rem  Set both foreground and background:
set highlight=bri whi on blu

rem  Numbers are also supported:
set highlight=46

If the Highlight environment variable is not defined, the plugin will check the registry for a value named Highlight of type REG_SZ. The plugin will search, in this order:

•  HKEY_CURRENT_USER\Software\JPPlugins\FileUtils(affects this plugin only)
•  HKEY_CURRENT_USER\Software\JPPlugins(affects several of my plugins)

Many commands also have a /D or /NC option to disable highlighting.

Startup Message:

This plugin displays an informational line when it initializes. The message will be suppressed in transient or pipe shells. You can disable it for all shells by defining an environment variable named NOLOADMSG, for example:

set /e /u noloadmsg=1

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find a problem, you can report it in the JP Software support forum.

FileUtils is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of the plugin from http://charlesdye.net/dl/fileutils.zip.