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