[SLE] Duplicating a directory structure



I need to duplicate a directory structure on a SuSE 10.0 box -- not the
files, just the directory tree.

I thought this would be pretty simple, using find, but I'm running into
big issues because many (as in almost all) of the directories have
spaces in their names. For the life of me I can't get the silly thing
to put everything where it should be.

The current directory structure is something like the following:
/tmp/origin
/tmp/origin/folder one
/tmp/origin/folder one/sub folder one
/tmp/origin/folder one/sub folder two
/tmp/origin/folder one/sub folder three
/tmp/origin/folder one/sub folder three/sub sub folder one
/tmp/origin/folder one/sub folder three/sub sub folder two
/tmp/origin/folder one/sub folder four
/tmp/origin/folder two
/tmp/origin/folder two/sub folder one
..
..
..

(Suffice it to say that the actual structure is much more complicated,
and, well, real. But not essentially different.)

What I'm trying to end up with is something like this:
/tmp/dest
/tmp/dest/folder one
/tmp/dest/folder one/sub folder one
/tmp/dest/folder one/sub folder two
/tmp/dest/folder one/sub folder three
/tmp/dest/folder one/sub folder three/sub sub folder one
..
..
..


I started off by doing this:
`cd /tmp/origin`
`find . -type d -print | xargs mkdir {}`

which gave me lots of errors like "mkdir folder: file exists" and "mkdir
one/sub: file exists". Clearly "folder" and "one/sub" are being seen as
distinct file names.

Anyone have any thoughts/advice on what I can do to duplicate the
structure? I know it's really just a question of quoting/escaping the
output of the find command, but for the life of me I can't figure out
where to put the quotes!

Thanks...

- IAn


--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-faq@xxxxxxxx



Relevant Pages

  • Replicating a directory structure
    ... What is the best way to duplicate a directory structure? ... achieve the same result as cp -r but only at the directory level, ... not at the file level. ...
    (comp.unix.misc)
  • Re: Efficient implementation of saving search state
    ... I am currently developing some ruby code that uses the File.find method ... to perform a depth first search of a directory tree. ... directory structure is projected to be millions of files, ... am asking for any guidance to tutorials, design patterns, and anything ...
    (comp.lang.ruby)
  • Re: Help needed configuring teTeX
    ... Tex directory structure. ... structure identical to the TDS and then you copied your files to ... to tell teTeX to use the new tree. ... re-arrange my existing OzTeX/CMacTeX additions directory tree to match ...
    (comp.text.tex)
  • Re: Tricky Data Import Question
    ... exity into the directory structure. ... The logistics of the directory structure is little more complex, ... it scans a directory tree and returns a list ... Your comment about legacy HW and code is correct. ...
    (comp.soft-sys.matlab)
  • Re: Tricky Data Import Question
    ... The logistics of the directory structure is little more complex, but there is a great amount of redundancy and simplicity to it. ... it scans a directory tree and returns a list ...
    (comp.soft-sys.matlab)