Operating System - HP-UX
1834935 Members
2188 Online
110071 Solutions
New Discussion

Re: Copy the file system structure

 
SOLVED
Go to solution
Ranjit_3
Advisor

Copy the file system structure

Hi ,
How to copy only the file system structure not the files within it .

e.g : I have a folder named "a" and inside one more folder named "b" with some files and similar folders . I just want to copy the empty file system structure with folders and sub-folders not the files .

Thanks in advance.
5 REPLIES 5
Bernhard Mueller
Honored Contributor

Re: Copy the file system structure

Ranjit,

cd
find . -xdev -type d | cpio -pduvmx

Regards,
Bernhard
Muthukumar_5
Honored Contributor
Solution

Re: Copy the file system structure

Yes. You can try as,

# go to source file system structure directory
cd /home/source

for dir `find . \( ! -name . \) -type d`
do

mkdir /home/dest/$dir

done

hth.
Easy to suggest when don't know about the problem!
Hilary Nicholson
Frequent Advisor

Re: Copy the file system structure

Use find with the option type d

find . -type d |cpio -pvdum

Regards,

Hilary
Pedro Cirne
Esteemed Contributor

Re: Copy the file system structure

Hi,

You can use:

#find /folder -type d -exec cp {} /new_structure \;

Enjoy :-)
Ranjit_3
Advisor

Re: Copy the file system structure

Thanks to all for the quick answers .

Bye...