This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: Re: Copying directory structure, but no files From: Charles Galpin <cgalpin@lighthouse-software.com> Date: Fri, 18 Jun 1999 23:06:43 -0400 (EDT) > > > We have a very deep directory tree on our Web site. We need to create a > > > pre-production version of this on the same server. The tree is pretty > > > elaborate and rather than make all these directories manually, I am > > > wondering if there is a way to copy a directory tree without copying any > > > of the files in those directories. Can anyone point me in the right > > > direction on this? > Charles Galpin wrote: > > > > I tried this and it worked for me. ymmv > > > > cd pre_prod_root > > mkdir `cd webdir;find . -type d -print | xargs` > > > > you will get a warning because it tries to make the dir '.' which exists > > On Sat, 19 Jun 1999, Chris Dowling wrote: > You might find problems with that one if the directory tree is very > large because your command line for mkdir will end up huge, and fail :( > (I've scratched my head here before too) > > Probably a more reliable solution would be > cd webdir > find . -name \* -type d -exec mkdir pre_prod_dir{} \; -print > > Note the curly brackets! They are important! yeah, I thought of that (after i sent it of course) I would have done it in two steps, first redirecting the list of dirs to a file, then using a simple perl script to change each line to a mkdir instruction, then running the generated script. Something like perl -ni -e 'print "mkdir $_";' dir_file would make the list a bunch of makedir commands === Subject: Re: Copying directory structure, but no files From: Jan Carlson <janc@iname.com> Date: Sat, 19 Jun 1999 00:09:43 -0400 gnielson wrote: > > We have a very deep directory tree on our Web site. We need to create a > pre-production version of this on the same server. The tree is pretty > elaborate and rather than make all these directories manually, I am > wondering if there is a way to copy a directory tree without copying any > of the files in those directories. Can anyone point me in the right > direction on this? Cpio can copy a whole directory tree without copying anything in the directories complete with all the directory attributes. mkdir /newdir cd /olddir find . -type d -print | cpio -pdmuv /newdir