Copying Files Using Mirror Issue 24

Do you have a laptop ? And want frequently to copy files to another system ? Use mirror !

I frequently have to exchange files between my laptop and other systems, eg. my home desktop. This can be conveniently done using rdist(1).

I wrote a small script called mirror, which basically contains a call of rdist setting up a small Distfile using the shell’s here syntax:

rdist  -d PWD=`pwd` -f -  mirror
        install -oyounger ${PWD};
        except_pat ( ~\\$ );
EOF

This is not the place to deal with rdist-syntax in greater detail, so see rdist‘s-manpage, if you like. Files will be copied to host mirror. Of course you have to set up /etc/hosts appropiately.

So working on a project with files in ~/wsp/pbd/os-tools, I can simply say

nana:/home/bav/wsp/pbd/os-tools> mirror
mirror: updating host mirror
mirror: /home/bav/wsp/pbd/os-tools/main-window.tcl: updating
mirror: /home/bav/wsp/pbd/os-tools/os-tools.tcl: updating
mirror: /home/bav/wsp/pbd/os-tools/popups.tcl: updating
mirror: updating of mirror finished

and mirror will copy new or changed files to the very same directory on the other node. This will be done recursively. Files on the other node, which are younger than the files on the node I started mirror on, will be mentioned, but remain untouched. Emacs-backup-files will not be copied.

Using the Option -verify, you can check what will be done without really doing anything:

nana:/home/bav/wsp/pbd/os-tools> mirror -verify
mirror: updating host mirror
mirror: /home/bav/wsp/pbd/os-tools/os-tools.tcl: need to update
mirror: /home/bav/wsp/pbd/os-tools/popups.tcl: need to update
mirror: updating of mirror finished

The option -f will remove extraneous files on node mirror. This is useful to get a real mirror:

nana:/home/bav/wsp/pbd/os-tools> mirror -f
mirror: updating host mirror
mirror: lulu: /home/bav/wsp/pbd/os-tools/qqq: removed
mirror: lulu: /home/bav/wsp/pbd/os-tools/otto: removed
mirror: /home/bav/wsp/pbd/os-tools/main-window.tcl: updating
mirror: /home/bav/wsp/pbd/os-tools/popups.tcl: updating
mirror: updating of mirror finished

Besides mirroring to another system’s disk mirror can be used to mirror the current directory to a floppy. This comes in handy for a quick kind of backup. There is no real advantage of using rdist when operating locally.

READ  X11-big-cursor MINIHOWTO: Related info

If there is enough space available, I use cp with the options -ruvp. To do so, call mirror with the option -floppy:

nana:/home/bav/wsp/pbd/os-tools> mirror -floppy
./main-window.tcl -> /floppy/./main-window.tcl
./os-tools.tcl -> /floppy/./os-tools.tcl
./popups.tcl -> /floppy/./popups.tcl

As with rdist, only new or changed files are copied. Mounting and unmounting the floppy is done by the script. Right now there is no way of handling extraneous files implemented.

In case you like this ideas, you can find my mirror-utility here.

Gerd Bavendiek Last modified: Thu Sep 24 22:24:59 MET DST

indexnew-1335908 homenew-8282783 back2-2030478 fwd-4366475