#!/bin/sh # du-a of filesystem such as removable disk to labelled file < du-a.* > # # "*" of "du-a.*" means the mount point "/*" mounted media. # If the name of this script is "du-a.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/.*du-a\.\(.*\)$/\1/"` OUT=$HOME/misc/rm-info CMD='du -a' # # 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.du-a.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 du-a outputs # if [ "$up" = "" ]; then exit else (cd $DIR; $CMD . 2> /dev/null | gzip > $of) echo "updated at $label" fi