ignatz (06/25/82)
How often have you either inherited a directory structure of code,documents, etc. and had to poke around in it to figure out what's going on? Or just gotten curious about HOW uucp is put together, and wanted to look at the listings? Or maybe wanted to run off a hardcopy archival listing of that software project you just finished? I know I have, and I don't know of any UNIX tool to print an entire directory structure. So, some time ago, I slapped together a script to do just that. It's posted in net.sources, and I call it 'traverse'. It is invoked as: traverse[[ directory]["command"]] If invoked with no arguments, it recursively descends the current directory structure, ordering the files alphabetically by type--insofar as it can determine the purpose of the file--and prints them. If a directory is given, it will use that directory as a starting point. If a command is given, it will become the operative command applied to the files found; otherwise, "pr" (with the appropriate options) is the default. The results are sent to standard out, and most probably will be sent through opr(1). It has shortcomings. It tries to guess what a file is via a combination of the results of file(1), suffix conventions, and some special checks resulting from getting burned, and attempts to avoid printing non-printable files. Nnevertheless, expect it to occasionally goof and give you some obscene printout if it hits some strange file it thinks is printable. Also, note that you can get a LOT of printout if you do something like, say, "traverse /". Caveat Utilitor. Also, as I use "pr" to output the results, the line length is set to 62 lines to allow for traverse's own header lines. This results in somewhat shorter pages than would be strictly possible if I handled the printing myself, but I didn't feel like re-inventing pr... I'm interested if anyone else has a similar or better utility to address this task; let me know directly if you do. Also, please send me any comments, fixes, complaints, or new features that may apply to traverse. Dave Ihnat Analysts International Corporation Contract site: BTL at Indian Hill ihuxl!ignatz (312) 979-6747