jmr@motown.UUCP (06/19/87)
I'm having a problem with which I could use some assistance... I've put together a shell script that is to look for files that have been touched in the past day and copy them to an "archive" directory. I'm using "find" with what I thought were the appropriate options, but the trouble is; find is picking up some files that have been *deleted*. I'm still trying to find some pattern to this, but so far without luck. The only thing I *have* noticed is that the actual directory entry has been over-written in each case, i.e. an "od" of the directory (or fsdb) shows that the file name really does not exist, not a case where the inode number is replaced by nulls and the name still stays in the slot. Also, so far, the files I could track down have never been linked to any other file. An fsck of the file system in question shows no problems. Below is the "one-liner" that I use. TOTAL=`find . -type f \( -ctime -1 -o -mtime -1 \) -exec /bin/ls -dis {} \; | sort +0 -1 -u | awk ' BEGIN {BLOCKS = 0;} {BLOCKS += $2; print $3 >> "'$DAYLIST'";} END {print BLOCKS;}'` The attempt is to create a DAYLIST file that includes inode, block size and name. The file is sorted by inode to capture only unique files and eliminate one or more links to the file. TOTAL is the sum of the blocks for each file, and is used later to see if there is enough free space for the files on the archive filesystem. But sure enough, if I try to list each file in DAYLIST, there are files in there that have been deleted. If it matters (but I doubt it), the script is run at 0005 each day. Any pointers or suggestions will be greatly appreciated! ------------------------------------------------------------------------------ "I enjoy working with human beings, and John M. Ritter have stimulating relationships with them." Allied-Signal, Inc. - HAL 9000 Corporate Tax Department {bellcore,clyde,ihnp4,princeton,rutgers}!motown!jmr ------------------------------------------------------------------------------