1 |
On Thu, Sep 20, 2012 at 12:04 PM, Michael Mol <mikemol@×××××.com> wrote: |
2 |
> On Thu, Sep 20, 2012 at 11:54 AM, Pandu Poluan <pandu@××××××.info> wrote: |
3 |
>> |
4 |
>> On Sep 20, 2012 10:04 PM, "Michael Mol" <mikemol@×××××.com> wrote: |
5 |
>>> |
6 |
>>> On Thu, Sep 20, 2012 at 10:48 AM, Neil Bothwick <neil@××××××××××.uk> |
7 |
>>> wrote: |
8 |
>>> > On Thu, 20 Sep 2012 16:13:08 +0200, Alan McKinnon wrote: |
9 |
>>> > |
10 |
>>> >> On the archive: |
11 |
>>> >> |
12 |
>>> >> find /root/of/dir/structure -type d > dirs.txt |
13 |
>>> >> find /root/of/dir/structure -type f > files.txt |
14 |
>>> > |
15 |
>>> > This will add '/root/of/dir/structure' to the start of each path. would |
16 |
>>> > it be better to do? |
17 |
>>> > |
18 |
>>> > cd /root/of/dir/structure |
19 |
>>> > find -type d > ../dirs.txt |
20 |
>>> > find -type f > ../files.txt |
21 |
>>> |
22 |
>>> I see your path correction, and raise you: |
23 |
>>> * whitespace-safe folders |
24 |
>>> * Automatic copy to remote system. |
25 |
>>> * Automatic new file and folder creation |
26 |
>>> * Using those pretty xargs parameters. |
27 |
>>> |
28 |
>>> cd /root/of/dir/structure |
29 |
>>> find . -type d -print0 > ~/dirs.txt |
30 |
>>> find . -type d -print0 > ~/files.txt |
31 |
>>> |
32 |
>>> scp dirs.txt files.txt remote.system: |
33 |
>>> |
34 |
>>> ssh remote.system <<ENDSSH |
35 |
>>> cd /root/of/new/structure |
36 |
>>> cat ~/dirs.txt|xargs -0 mkdir -p |
37 |
>>> cat ~/files.txt|xargs -0 touch |
38 |
>>> ENDSSH |
39 |
>>> |
40 |
>>> |
41 |
>> |
42 |
>> Cool... except that your raise is invalid (should've used -type f in the 3rd |
43 |
>> line)... |
44 |
>> |
45 |
>> ;-) |
46 |
>> |
47 |
> |
48 |
> Heh. It's also performing a bunch of unnecessary mkdir commands. I |
49 |
> mean, "find -type d" isn't going to return a subpath of a folder until |
50 |
^^ s/subpath/subfolder/ ^^ |
51 |
|
52 |
|
53 |
-- |
54 |
:wq |