Operating System - HP-UX
1753990 Members
7809 Online
108811 Solutions
New Discussion юеВ

Re: question on find command

 
SOLVED
Go to solution
Doug_3
Frequent Advisor

question on find command

Hi there, I have a simple question I am unable to find an answer to in man, itrc or the internet.

I have been using find in various ways to locate files buried deep into dir structures. I want to make a quick cpio to a nfs share on a disaster recovery server. The command did not work as I expected, copying the directory but it did not copy the directories/files.

cd /
find . -xdev -depth -print | cpio -pdmuv /drnfs/cpio2011May26

This copied say /etc and associated directories but did not copy /mydir/mydir2/myfile123.

I must be missing something easy or not understanding how the find command navigates the directory structure. Any help will be greatly appreciated.
Regards,
Doug
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: question on find command

Hi Doug:

The 'find()' did what you told it to do --- don't cross mountpoints.

You limited directory traversal to '/' without visiting any mountpoints (in HP-UX, '/usr', '/var', '/opt', etc.). SInce '/etc' isn't a separate mountpoint it was copied. I have to assume that '/mydir' is a mounted filesystem.

Regards!

...JRF...
Wilfred Chau_1
Respected Contributor

Re: question on find command

remove the -xdev option if you want to traverse on other filesystems.
Doug_3
Frequent Advisor

Re: question on find command

sheesh, I blew right past that in the man page. Thanks to both of you.