Gentoo Archives: gentoo-user

From: Andrew Lowe <agl@×××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Recreating a directory structure and indicating a files presence
Date: Sun, 23 Sep 2012 16:37:36
Message-Id: 505F3991.8070509@wht.com.au
In Reply to: Re: [gentoo-user] Recreating a directory structure and indicating a files presence by Alan McKinnon
1 On 09/20/12 22:13, Alan McKinnon wrote:
2 > On Thu, 20 Sep 2012 20:33:39 +0800
3 > Andrew Lowe <agl@×××××××.au> wrote:
4 >
5 >> Hi all,
6 >> I have the situation where I have a large amount of data,
7 >> many TB's, made up of many, many files. This information has now been
8 >> archived but I've got people who want to be able to see what data
9 >> does/does not exist, filling in gaps where they may exist.
10 >>
11 >> As this data used to be available/visible in a directory
12 >> structure, ie via a file browser, I thought the easiest way for them
13 >> to see if something existed would be to create a mirror of the
14 >> directory structure and then populate this dir structure with 1 - 5
15 >> byte files with the same name as the "real" data files that now
16 >> reside in the archive. I've seen some scripts on the interweb that
17 >> allow me to create the dir structure, but does anyone have any ideas
18 >> how to do the creation of the "marker" files in the active file
19 >> system?
20 >>
21 >> Just buying more hard disks and keeping the data on line also
22 >> isn't an option.
23 >>
24 >> Any thoughts, greatly appreciated,
25 >>
26 >> Andrew
27 >>
28 >
29 > I don't understand why you specify 1-5 byte files. Those few bytes will
30 > always be useless. Rather use 0-length files.
31 >
32 > On the archive:
33 >
34 > find /root/of/dir/structure -type d > dirs.txt
35 > find /root/of/dir/structure -type f > files.txt
36 >
37 > Copy those two files to the on-line system:
38 >
39 > for I in `cat dirs.txt` ; do mkdir -p $I ; done
40 > for I in `cat files.txt` ; do touch -p $I ; done
41 >
42 > Do that in the appropriate top-level directory of course. You can
43 > probably make it more efficient using decent options to xargs, but what
44 > the hell, I'd do it as-is. It's a once off action and finding the xargs
45 > man page will take longer than the mkdirs....
46 >
47
48 Gentlemen,
49 Thanks for the suggestions, worked like a charm. I did the above and
50 except for whitespaces, which shouldn't have been there in the first
51 place and "-", things went well. As to the reason for 1 - 5 bytes, I
52 forgot about zero length files.....
53
54 Andrew