jaymin@tcdmath.UUCP (Joe Jaquinta) (11/27/86)
In article <415@ethz.UUCP> srp@ethz.UUCP (Scott Presnell) writes: >Hello, >I have an interest in a program that will display the oragnization of a >directory tree in UNIX (or MSDOS)... Not exactly what you want but I find it *very* useful as a general program. j^2 To unbundle, run sh on this file... -----------------><--><--><------------------------- #!/bin/sh echo x - flst.1 sed 's/^X//' > flst.1 << '!End!Of!Sharchive!' X.TH flst 1 "Trinity College Dublin" X.SH NAME Xflst - fast listing sub-tree X.SH SYNOPSIS Xflst [directory(s)] X.SH DESCRIPTION X.I Flst Xlists a tree file system or systems specified in the argument Xwith indentation reflecting the level Xof nesting of the file in the file system. If no argument is Xgiven X.I flst Xtakes the current directory as default. X.SH SEE ALSO Xls(1), lstree(1) X.SH DIAGNOSTICS X.br XIt cannot list files nested more than twenty levels. !End!Of!Sharchive! echo x - flst.c sed 's/^X//' > flst.c << '!End!Of!Sharchive!' X#include <stdio.h> X#include <sys/types.h> X#include <sys/dir.h> X#include <sys/stat.h> X Xint siz, level; Xchar tabs[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X X level = 0; X siz = sizeof(struct direct); X if (argc == 1) X pdir(); X else while (*++argv) X if (chdir(*argv) >= 0) X pdir(); X else X iprint("Cannot access directory"); X} X Xpdir() X{ X struct direct entry; X struct stat filetyp; X int fp; X X fp = open(".", 0); X if (fp < 0) X { X iprint("Bad Open"); X return; X } X while (read(fp, &entry, siz)) X if (entry.d_ino) X { X stat(entry.d_name, &filetyp); X if (!strcmp(entry.d_name, ".q")) X continue; X if (!strcmp(entry.d_name, "..")) X continue; X if (!strcmp(entry.d_name, ".")) X continue; X iprint(entry.d_name); X if (filetyp.st_mode & S_IFDIR) X { X level++; X if (chdir(entry.d_name) >= 0) X pdir(); X else X iprint("Cannot access directory"); X level--; X } X } X close(fp); X chdir(".."); X} X Xiprint(string) Xchar *string; X{ X write(1, tabs, level); X write(1, string, strlen(string)); X write(1, "\n", 1); X} !End!Of!Sharchive! -- ...{decvax,seismo}!mcvax!ukc!einode!tcdmath!jaymin Io, the greek goddess of input and output. -- D. E. Knuth
lenoil@apple.UUCP (Robert Lenoil) (12/04/86)
In article <415@ethz.UUCP> srp@ethz.UUCP (Scott Presnell) writes: >Hello, >I have an interest in a program that will display the oragnization of a >directory tree in UNIX (or MSDOS)... There is a wonderful public domain program for MSDOS called TREED, whose banner says that it is written by "R A Flavin". It graphically displays the directory structure of a disk, with output like this: ___BIN | |_DOC___RELEASED | |_WORKING | |_SRC ... I wish I knew where you could download it from; I got my copy from a friend who doesn't remember where his came from. Perhaps someone on the net can provide this information. Robert Lenoil