LS 3.4 List Files Page 1 Directory lister ala Unix for generic MS-DOS 2.0 or higher. Advantages (admittedly a matter of (good) taste) over DIR: o Alphabetical order by default o Default is "wide" (/W in DIR-speak) o Default is to omit ".", "..", hidden files, and volume ID o Lists day of week (Monday, Tuesday ...) o Uses 24-hour time o Lists byte-count & directory-count totals o Shows file attributes o Flags directories o Prints commas in large numbers o Pauses on full screen ("More") Useful options: o List only files dated after a given date o List only files changed since last backup o Recursively list sub-directories o Show remaining space on drive only o Show total file space only o Sort by file date & time o Sort by file extension o Sort by file size o Exclude files from listing o Feed file list into filter LS is intended for use with a Winchester or RAM disk. There is a slight delay on large directories as LS must read up all directory entries and sort them before displaying the first. Usage: ls [-abcdefghlmnorstuvxy2] [-w[]] [] ... The square brackets indicate optional arguments. indicates a file specification of the form accepted by DIR, formally: [:][][][.[]] All components are optional and have the same defaults as DIR. The and portions may contain wildcard characters. A plain ls will list all files in the current directory (except hidden files, volume ID, ".", and "..") sorted alphabetically, five per line. The number of files matched is always given, along with the total byte count of files matched. Directory names are appended with a backslash. LS 3.4 List Files Page 2 The options are as follows (mnemonics given in parentheses) -a (All) List ".", "..", hidden files, and volume ID if matched -b (But) Inverts the meaning of -c -d -t -y and -w (see below) -c (Changed) Restrict matches to files changed since backup -d (Directories) Restrict matches to directories -e (Extension) Sort alphabetically on file extension -f (Filter) Single-column (filter-ready) listing -g (Go) Don't pause for user go-ahead when screen fills -h (Hugest) Sort by size, largest to smallest -l (Long) Long listing: dates, sizes & attributes -m (Minisculest) Sort by size, smallest to largest -n (Newest) Sort by date & time, newest to oldest -o (Oldest) Sort by date & time, oldest to newest -r (Recursive) Search subdirectories recursively -s (Summary) List only total counts and sizes -t (Today) Restrict matches to files dated today -u (Unused) Shows space remaining on drive (no files listed) -v (Version) Show LS version only -w (When) Restrict matches to files dated on or after a given date, where is one of o A full date, e.g. 11/22/85 o A day in the current year, e.g. 11/22 o A day of the current month, e.g. 22 A missing date restricts matches to files dated in the current week, beginning on Monday (Week) -x (eXcept) Don't list files matching subsequent arguments -y (Yesterday) Restrict matches to files dated yesterday or today -2 (2-column) 2-column version of long listing, omitting some of the information given with -l -? (Huh?) Show command format Options may be combined, e.g. ls -aln *.c or segregated: ls -a *.c -ln The -w option should be last (or alone) in a group. The -b option inverts the meaning of -c -d -t -w and -y; thus ls -bd will list all non-directory files, ls -bt .exe will list all .EXE files but those dated today, and LS 3.4 List Files Page 3 ls -bw1/1/85 will list all files dated before 1985. The -x option excludes from the listing files matching ALL subse- quent arguments (this is a change from former versions), thus ls -x *.c .asm means list all files except .C files and .ASM extensions, and ls p*.* -x *.exe means list all files beginning with P except .EXE files. In the attributes given in the long (-l) listing, W means read/ write, R means read-only, H means hidden, S means system file, and A means changed since last archive (backup). Two byte counts are given with -l. The first is the number of bytes of data in the file; the second is the amount of room the file takes up on the disk (disk space is allocated in largish fixed-size increments). The -s option does not list file names, but rather gives a summary of the count and total size of the files specified. The -f option is intended for use with filters; matching files are listed one per line, with no heading or summary information. Only one of the -e, -h, -m, -n, or -o sorting options should be given. If the screen fills and neither standard input nor standard output have been redirected, LS pauses and prompts with More? An answer of 'N' or 'n' (No) or '^C' will terminate LS; 'G' or 'g' (Go) continues with no more pauses; anything else continues to the next screen full. The -g option can be used to override this feature. Examples: o All ordinary files in current directory ls o All non-directory files ls -bd o Long listing of files LS.* ls -l ls LS 3.4 List Files Page 4 o Long listing of files dated today: ls -alt o Files dated this week ls -w o All .EXE files, newest to oldest: ls -n .exe o All .C files dated on or after November 3, 1984 ls -w11/3/84 .c o All files dated this year, oldest to newest ls -lw1/1 -o o All files dated on or after the 3rd of this month ls -w3 o All non-.EXE and non-.COM files, sorted by extension ls -x .exe .com -e o Count size and number of .exe files in current directory and below: ls -rs .exe o List all files on current disk not backed up: ls -cr \ o Get count and size of all files on current disk not backed up: ls -crs \ o List all directories on the disk ls -rfd \ Copyright (c) 1985,86,87, Bryan Higgins. The author may be reached/rewarded at 1802 Channing Way Berkeley, CA 94703 One of the Kramden Utilities.