rbj@icst-cmr.arpa (Root Boy Jim) (04/27/88)
From: Dennis John Linse <djlinse@phoenix.Princeton.EDU> Last night I was trying to figure out how to due an incremental backup on a Silicon Graphics Iris running System V. The manual suggested using find . -mtime -7 -print | tar c - The problem I encountered was that the find command finds all of the directories along the way. For example the output of find might be ./bin ./bin/foo where foo is a file to be backed up. When tar gets this, it recursively backs up the entire bin directory. After much work, I came up with the command find . \( -mtime -7 -exec test -f {} \; -print \) | tar c - which seems to due the trick. Right idea, but see below. The questions I have are 1) Is this the best way or is there a better one? Replace "-exec test -f {} \;" with "-type f". 2) Does the resulting archive have the necessary directory information to recreate the files in the event that they are needed? Specifically, if a directory doesn't exist when the archive is read back in, will it be created properly? Yes. Tar creates directorys, but does not restore their modification time correctly. Additionally, the owner/group/mode will not necessarily be set correctly if the directory does not exist when restoring it. Additionally, symbolic links may give you trouble. Perhaps you might want "! -type d" instead of "-type f". You may also want to add a "| fgrep -v -f filesnotosave |" between the find and the tar. Dennis (Root Boy) Jim Cottrell <rbj@icst-cmr.arpa> National Bureau of Standards Flamer's Hotline: (301) 975-5688 The opinions expressed are solely my own and do not reflect NBS policy or agreement TAILFINS!! ...click...