1. Overview. DU is a small UNIX-like utility to show how much space is occupied by a directory tree. It can show how much space is occupied by the entire directory tree or by any number of filespecs, optionally excluding any number of filespecs, it can show the size of every file, just the directory totals, or just the grand total. Starting with v1.09 DU is supposed to accept the (all too few) Unix-du- options. 2. Basic syntax. Arguments may be options, filespecs or directory names. The directory names separate the other arguments into global and local arguments: du {global arguments} {base directory {local arguments} } DU searches through each directory for the files specified before the first directory name (global arguments) and those between this and the next directory name (local). If no directory name is specified, . (the current directory) is used. Later options override earlier, eg. a local /0 overrides a global /1. If any include filespecs are specified, the directory table will not be counted in the directory size. Exclude filespecs don't matter. Both / and \ may be used in paths, and both / and - as switch character. DU will generally figure out what you mean. If it doesn't you'll get an error message. 3. Command line options. Option a (du /a or du -a) will list the file sizes as well as the directory totals. Option d will show DU's interpretation of the arguments. Option e will limit the search to files dated earlier than the date given. Example: -e010101, that is, files dated on or before January 1, 2001. The format is DDMMYY in Europe, DDMMYY in the US and YYMMDD in Japan; for the rest of the world it should be the same as DIR uses. Option h (or ?) will display a short help screen. Option i will include the following filespecs; refer to part 4. Option l will limit the search to files dated later than the given date; see -e. Option n will not include subirectories in the directory size. Option s will skip the directory totals and display only the sum. This is exactly the same as -0. Option w will show the percentage of space wasted due to too-large clusters. Option z will suppress 0k files and directories. Option 0..65535 shows directories down to the specified level. Directories deeper are counted but not listed. Option x will exclude the following filespecs, refer to part 4. 4. Filespecs. Standard Unix DU always counts all the files. This version, however, allows you to count only some files or all except some files. If you don't specify an include filespec, * (which matches everything) will be used. If you do specify one or more filespecs, only files matching one (or more) of the specs are counted. You can exclude files as well, and include files again. The filespecs aren't limited by the normal brainless DOS rules. * and ? work, but match . as well as normal chars. You can also match a list, like [a-cx], which matches a, b, c and x. Note that it isn't completely Unix- ish either. I haven't matched the extended 4DOS 4.0 filespecs either; I don't use all that, and anyway they don't use the standard Unix metacharacters. 5. Examples. Sorry, you won't find examples of every last option here. As you can see, I use both / and - as switch characters. du -1 / shows how much each directory subtree takes, counting all the directories but showing only those directly below the root. du -az *asm* -x ?asm.* displays the size and path of every file whose name contains ASM anywhere except in the 2..4 position, and how much space these files occupy in each directory. Empty directories are not shown. RM.ASM and OBJ2ASM.COM is listed, TASM.EXE isn't. du -zn *.obj shows how much space is occupied by .obj files in each directory that contains at least one (0k directories aren't shown). .obj files in subdirectories aren't counted in the directory size. du -as *.bak *.bk[!1-9] *.old shows all the backup files in the directory tree, ie. files with a file type of BAK, BK!, BK1, BK2, BK3, BK4, BK5, BK6, BK7, BK8, BK9 or OLD. du /x *.bak *.bk[!1-9] shows the directory totals excluding any backup files. du *gif* -x *gif*.exe /i vgif* searches for files containing 'gif' anywhere in the name or extension, except files containing 'gif' in the name and with an extension of 'exe', but including files whose name starts with 'vgif'. Pretty far-fetched. du /s *.zip *.arc *.arj *.a[0-9][0-9] *.lzh *.gif *.jpg *.pcx *.bmp finds out how much of your precious hard disk is wasted on archives or pretty pictures. du -l010791az | grep -v .*/$ shows the files added or changed since July 1, 1991. The date format may be different for you. The grep filters away the directories (lines that end with a / are thrown away). 6. Bugs The root directory doesn't exist, according do Mess-DOS' own FindFirst function. My workaround is to search for a directory called 'dirname' first, and if that doesn't work to search for anything called 'dirname\*.*'. This should work for everything except completely empty drives. The directory table size is only an estimate, and sometimes too low. DU does some checking for cluster sizes, not much. JOIN, SUBST and many networks will fool it; in those cases it assumes either 1k or the cluster size of the default drive. The 'wasted space' percentage is incorrect on Stacker volumes, as Stacker will use the 'wasted' space for something. DU often says that more space is wasted that Norton FS does. This is because DU counts the directory table as well as the files. You can't start filespecs with / or -, to avoid clashes with options and base directories. DU may crash when used on network drives with very deep directory trees; some networks don't allow the argument to the DOS FindFirst function to be long enough to specify the longest actual path. If you have any questions or comments, my preferred email address is arnt@swix.ifi.unit.no.