find command

Conor P. Cahill cpcahil at virtech.uucp
Tue Nov 28 15:36:52 AEST 1989


In article <21544 at adm.BRL.MIL>, mchinni at pica.army.mil (Michael J. Chinni, SMCAR-CCS-E) writes:
> I was reading an article in a magazine, and the article was talking about the
> find command. It mentioned as an example:	find / -depth -print
> 
> Now I have RTFM (both on BSD-based systems and SysV-based system) and
> I can find no option -depth, furthermore, when I try the example I get:
> find: bad option < -depth >

The "-depth" option to find, where it is supported, tells find to visit 
all files in the directory before visiting the directory itself.  This is
needed for the following scenario:

	Directory A exists and has files in it.  

		Normal Find -print	Find -depth -print
		A			A/file1
		A/file1 		A/file2...
		A/file2...		A

		Note that the directory itself (A) is listed last.

	I only have read access to A.
	I am not a super user.
	I want to restore a backup of A.


If the backup was made with standard find (i.e. "-depth" not specified) then
my cpio backup will have the directory on the tape before the files within
the directory.  The directory will be created and set to read-only and I 
will then be unable to restore the files.

If the -depth is specified the directory will be created, but with my ownership
and standard modes when the files are restored and then the modes and ownership
of the directory will be modified to match those on the tape.


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list