Trying to copy a directory structure without all of the files.

Hi, Is there a way to copy a directory structure with a number of subdirectories without all of the directory files coming along with it. I thought the cpio command would do that but I can't figure out how to use it.
[231 byte] By [johnpatrickwalsh] at [2007-11-26 11:53:22]
# 1

CPIO needs a list of files, normally you generate them with 'find', so that would work.

There's an old thread about this on comp.unix.solaris. Personally, I like my 'rsync' solution. :-) But reading the entire thread may be a good idea.

http://groups.google.com/group/comp.unix.solaris/browse_thread/thread/e84b458b3 ce4b3b8/

--

Darren

Darren_Dunham at 2007-7-7 12:10:10 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2
Darryl, This is the error message I received from a Unix Solaris 9 system (see below)<- epen04 jowalsh ->rsync -a --include "*/" --exclude "*" test/sas09bash: rsync: command not found
johnpatrickwalsh at 2007-7-7 12:10:10 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3
Solaris 9 doesn't have rsync installed in the distribution. Grab a package from somewhere like sunfreeware or blastwave if you want to use that method.-- Darren
Darren_Dunham at 2007-7-7 12:10:10 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4
You could gtar it i guess;/usr/sfw/bin/gtar --exclude "pattern" -cf - <source directory> | (cd <target root> ; /usr/sfw/bin/gtar xf -) .7/M.
mAbrante at 2007-7-7 12:10:10 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 5

You can make it simple with the "find" command:

$> cd /<someDIR>

$> for i in `find * -type d`; do mkdir /<newDIR>/$i; done

This will look in the complete "someDIR" directory tree and find all the directories only in order. Then one at a time it will make a new directory in the "newDIR" and follow it down until complete.

Lee_McCreery at 2007-7-7 12:10:10 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...