xref: /386bsd/usr/local/bin/utree.mklist (revision a2142627)
1:
2#
3#       UTREE.MKLIST.SH
4#       UTREE create tree directory list for quicker startup
5#       3.03-um klin, Sun Feb 16 16:08:03 1992
6#       Usage:          utree.mklist [-a] [root_directory list_file]
7#       Options:        -a      Read in all (including hidden) directories
8#       Directory:      /usr/local/bin
9#
10#       Copyright (c) 1991/92 by Peter Klingebiel & UNIX Magazin Muenchen.
11#       For copying and distribution information see the file COPYRIGHT.
12#
13#       SCCSID = @(#) utree 3.03-um (klin) Feb 16 1992 bin/utree.mklist.sh
14#       USAGE  = @(#) Usage: utree.mklist [-a] [root_directory list_file]
15
16if test $# -ne 0 -a "$1" = "-a" # Option given ?
17then
18  AFLAG=-a
19  shift
20else
21  AFLAG=
22fi
23
24if   test $# -eq 2              # Rootdirectory given ?
25then
26  ROOT=$1
27  LIST=$2
28elif test $# -eq 0              # Rootdirectory is homedirectory
29then
30  ROOT=$HOME
31  LIST=$HOME/.utreelist
32else
33  echo "Usage: utree.mklist [-a] [root_directory list_file]"
34  exit 1
35fi
36
37echo "# UTREE tree list created at `date`" >$LIST
38if test "$AFLAG" = "-a"
39then
40  find $ROOT -type d -print | sort >>$LIST
41else
42  find $ROOT -type d -print | grep -v "/\." | sort >>$LIST
43fi
44exit 0
45