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


-- 
:wq

Reply via email to