Re: Nightmare on Elm Street with Win2k Professional

From: Stephen D. Williams (sdw@lig.net)
Date: Thu Mar 29 2001 - 22:40:08 PST


Eirikur Hallgrimsson wrote:
>
> [ Extreme shell geekery. Not of any other interest. ]
>
> I use cp -rauvx as my fallback, but this won't copy hidden files and I've
> not figured out a way to get cp to do that.
>
> I prefer to use cpbk, "backup copy" which can be found on Freshmeat.
>
> A really cute hack that I learned from a colleague on this Tru-64 adventure
> is to run two copies of tar piped. This preserves all the file attributes,
> dates, etc, and offers all the features of tar. I turned it into a utility
> shell script thusly:
>
> #!/bin/bash
> # tar $1, pipe to tar and unpack in destination $2
> tar -c $1 | tar -C $2 -xvf -

The canonical Unixen solution for this is: find * -print|cpio -pdumv
DEST. 'cpio -p' is expressly meant for this. I'm not sure if tar
completely and correctly groks all needed Unix semantics like holey
files, symlinks, and especially hard links. Cpio does it all, although
a few years ago there were many versions of the more or less standard
file format floating around.

Of course you can also do something like: find * -print |cpio -o|ssh
ANOTHERMACHINE 'cd DEST;cpio -idumv' to do a perfect copy over a
lan/wan, securely and with optional compression.

> If you put that into a file, and make a command alias for it, you get a
> command that takes two directories as arguments and copies the first one (and
> its entire tree) into the second one.
>
> tarcopy /sourcedir /destdir
>
> That results in a /destdir/sourcedir that is a the best facsimile of the
> original that I know how to get.
>
> Eirikur

sdw

-- 
sdw@lig.net  http://sdw.st
Stephen D. Williams
43392 Wayside Cir,Ashburn,VA 20147-4622 703-724-0118W 703-995-0407Fax 
Dec2000



This archive was generated by hypermail 2b29 : Fri Apr 27 2001 - 23:15:14 PDT