Gentoo Archives: gentoo-user

From: Pandu Poluan <pandu@××××××.info>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Recreating a directory structure and indicating a files presence
Date: Thu, 20 Sep 2012 15:56:21
Message-Id: CAA2qdGVKh-d-Xs5+6x2pj18apoS+DqJ4iW0=3m1Pb4qtZ1Xaeg@mail.gmail.com
In Reply to: Re: [gentoo-user] Recreating a directory structure and indicating a files presence by Michael Mol
1 On Sep 20, 2012 10:04 PM, "Michael Mol" <mikemol@×××××.com> wrote:
2 >
3 > On Thu, Sep 20, 2012 at 10:48 AM, Neil Bothwick <neil@××××××××××.uk>
4 wrote:
5 > > On Thu, 20 Sep 2012 16:13:08 +0200, Alan McKinnon wrote:
6 > >
7 > >> On the archive:
8 > >>
9 > >> find /root/of/dir/structure -type d > dirs.txt
10 > >> find /root/of/dir/structure -type f > files.txt
11 > >
12 > > This will add '/root/of/dir/structure' to the start of each path. would
13 > > it be better to do?
14 > >
15 > > cd /root/of/dir/structure
16 > > find -type d > ../dirs.txt
17 > > find -type f > ../files.txt
18 >
19 > I see your path correction, and raise you:
20 > * whitespace-safe folders
21 > * Automatic copy to remote system.
22 > * Automatic new file and folder creation
23 > * Using those pretty xargs parameters.
24 >
25 > cd /root/of/dir/structure
26 > find . -type d -print0 > ~/dirs.txt
27 > find . -type d -print0 > ~/files.txt
28 >
29 > scp dirs.txt files.txt remote.system:
30 >
31 > ssh remote.system <<ENDSSH
32 > cd /root/of/new/structure
33 > cat ~/dirs.txt|xargs -0 mkdir -p
34 > cat ~/files.txt|xargs -0 touch
35 > ENDSSH
36 >
37 >
38
39 Cool... except that your raise is invalid (should've used -type f in the
40 3rd line)...
41
42 ;-)
43
44 Rgds,

Replies