#!/bin/sh # ls-R of filesystem such as removable disk to labelled file < ls-R.* > # # "*" of "ls-R.*" means the mount point "/*" mounted media. # If the name of this script is "ls-R.mo", then target directory is "/mo". # Output directory is "~/misc/rm-info" for infomation of removable media. # Lable name of target media is wrote to the name "00_LABEL" # in the target directory at first. # # Copyright (C) 1999 Taiji Yamada # DIR=/`echo $0|sed "s/.*ls-R\.\(.*\)$/\1/"` OUT=$HOME/misc/rm-info CMD='ls -R -l' # # checking label of file system # if [ ! -d $DIR/lost+found ]; then echo "ls-R.*: file system $DIR is not found." exit fi if [ -f $DIR/00_LABEL ]; then label=`cat $DIR/00_LABEL` else echo -n "input label name: " read label echo -n $label > $DIR/00_LABEL fi # # determin filename by label name for the file system and check updating # of=$OUT/$label.ls-R.gz if [ ! -f $of ]; then up="yes" else up=`find $DIR/ -newer $of -print 2> /dev/null` fi # # output information of file system to labelled file by ls-R outputs # if [ "$up" = "" ]; then exit else (cd $DIR; $CMD . 2> /dev/null | gzip > $of) echo "updated at $label" fi