On Thu, Sep 20, 2012 at 12:04 PM, Michael Mol <mike...@gmail.com> wrote:
> On Thu, Sep 20, 2012 at 11:54 AM, Pandu Poluan <pa...@poluan.info> wrote:
>>
>> On Sep 20, 2012 10:04 PM, "Michael Mol" <mike...@gmail.com> wrote:
>>>
>>> On Thu, Sep 20, 2012 at 10:48 AM, Neil Bothwick <n...@digimed.co.uk>
>>> wrote:
>>> > On Thu, 20 Sep 2012 16:13:08 +0200, Alan McKinnon wrote:
>>> >
>>> >> On the archive:
>>> >>
>>> >> find /root/of/dir/structure -type d > dirs.txt
>>> >> find /root/of/dir/structure -type f > files.txt
>>> >
>>> > This will add '/root/of/dir/structure' to the start of each path. would
>>> > it be better to do?
>>> >
>>> > cd /root/of/dir/structure
>>> > find -type d > ../dirs.txt
>>> > find -type f > ../files.txt
>>>
>>> I see your path correction, and raise you:
>>> * whitespace-safe folders
>>> * Automatic copy to remote system.
>>> * Automatic new file and folder creation
>>> * Using those pretty xargs parameters.
>>>
>>> cd /root/of/dir/structure
>>> find . -type d -print0 > ~/dirs.txt
>>> find . -type d -print0 > ~/files.txt
>>>
>>> scp dirs.txt files.txt remote.system:
>>>
>>> ssh remote.system <<ENDSSH
>>> cd /root/of/new/structure
>>> cat ~/dirs.txt|xargs -0 mkdir -p
>>> cat ~/files.txt|xargs -0 touch
>>> ENDSSH
>>>
>>>
>>
>> Cool... except that your raise is invalid (should've used -type f in the 3rd
>> line)...
>>
>> ;-)
>>
>
> Heh. It's also performing a bunch of unnecessary mkdir commands. I
> mean, "find -type d" isn't going to return a subpath of a folder until
^^ s/subpath/subfolder/ ^^


-- 
:wq

Reply via email to