poSoft Text Logo
Tcl extensions
SGI related
Currently selected Unsupported
Tcl and VC2005
mktclapp patch
photo patch
glob patch
Related links
poSoft Logo
Valid XHTML 1.0 Transitional

glob command - Patch for extended functionality


This is the proposal of an extension to the glob command:
Negation of the -types specifiers b c d f l p s r w x hidden readonly

With this additional specifiers it is possible to easily answer questions like the following:

Give me a list of all entries, which are not directories: -types !d
Give me a list of all entries, which are not directories and not hidden: -types {!d !hidden}
Give me a list of all directories, which are not hidden: -types {d !hidden}

These are typical questions when writing a file manager like application.

You are able to manage this with current Tcl commands, but if the number of entries in a directory is high, it tends to get slow.

Another additional change I made is to increase performance on FAT file systems.
On FAT file systems using the -types option is not usable, if you have more than appr. 1000 directory entries. This is due to the fact, that the -types option implies a call to the stat (TclpStat) command for each matching directory entry, which is a performance killer on FAT.
But some file attributes are already known from function findNextFileProc: IsDirectory, IsHidden, IsReadOnly.
So the above noted queries are quite fast on FAT, too.

  • The necessary changes can be applied as a patch against Tcl8.3.2 and Tcl8.3.3.
  • Tested on Windows98, Linux 2.4 and SGI IRIX 6.5.
  • I have adopted the Mac sources, too, but do not have the chance to test these.
Top of page


File name Description
globPatch.zip Patched source files based on Tcl version 8.3.2 and 8.3.3
Top of page