1 |
On Thu, Sep 20, 2012 at 10:48 AM, Neil Bothwick <neil@××××××××××.uk> wrote: |
2 |
> On Thu, 20 Sep 2012 16:13:08 +0200, Alan McKinnon wrote: |
3 |
> |
4 |
>> On the archive: |
5 |
>> |
6 |
>> find /root/of/dir/structure -type d > dirs.txt |
7 |
>> find /root/of/dir/structure -type f > files.txt |
8 |
> |
9 |
> This will add '/root/of/dir/structure' to the start of each path. would |
10 |
> it be better to do? |
11 |
> |
12 |
> cd /root/of/dir/structure |
13 |
> find -type d > ../dirs.txt |
14 |
> find -type f > ../files.txt |
15 |
|
16 |
I see your path correction, and raise you: |
17 |
* whitespace-safe folders |
18 |
* Automatic copy to remote system. |
19 |
* Automatic new file and folder creation |
20 |
* Using those pretty xargs parameters. |
21 |
|
22 |
cd /root/of/dir/structure |
23 |
find . -type d -print0 > ~/dirs.txt |
24 |
find . -type d -print0 > ~/files.txt |
25 |
|
26 |
scp dirs.txt files.txt remote.system: |
27 |
|
28 |
ssh remote.system <<ENDSSH |
29 |
cd /root/of/new/structure |
30 |
cat ~/dirs.txt|xargs -0 mkdir -p |
31 |
cat ~/files.txt|xargs -0 touch |
32 |
ENDSSH |
33 |
|
34 |
|
35 |
-- |
36 |
:wq |