Gentoo Archives: gentoo-user

From: Etaoin Shrdlu <shrdlu@×××××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Cloning a directory hierarchy, but not the content
Date: Sat, 29 Jan 2011 14:13:54
Message-Id: 201101291412.p0TECGZV014731@dcnode-02.unlimitedmail.net
In Reply to: [gentoo-user] Cloning a directory hierarchy, but not the content by Alex Schuster
1 On Sat, 29 Jan 2011 14:58:13 +0100
2 Alex Schuster <wonko@×××××××××.org> wrote:
3
4 > Hi there!
5 >
6 > I am currently putting extra backups to old hard drives I do no longer
7 > need for other purposes. After that I send the putput out ls -lR and du
8 > -m to my log directory so I can check what files are on which drive
9 > without having to attach the drive.
10 >
11 > Works, though a better method would be to clone the drive's root
12 > directory, but with all file sizes being zero. This way I can easily
13 > navigate the directory structure, instead of browsing through the ls-lR
14 > file. Is there a utility that does this? It would be even better if the
15 > files would be created as sparse files, faking the original size.
16 >
17 > I just wrote a little script that does this, but it does not do the
18 > sparse file thing yet, and would have problems with newline in file
19 > names. And I guess someone already wrote such a utility?
20
21 IIUC, try
22
23 find / -type d -exec sh 'mkdir -p target"$1"' - {} \;

Replies

Subject Author
Re: [gentoo-user] Cloning a directory hierarchy, but not the content Alex Schuster <wonko@×××××××××.org>