Mailinglist Archive: opensuse (2831 mails)

< Previous Next >
[SLE] Duplicating a directory structure
  • From: "Marlier, Ian" <ian.marlier@xxxxxxxxxxxxxxxxxxx>
  • Date: Thu, 27 Jul 2006 14:11:07 -0400
  • Message-id: <D2575519D6CA2840B6D3E26087EA71B6C944@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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


< Previous Next >