Re: Nightmare on Elm Street with Win2k Professional

Date: Sun Apr 01 2001 - 03:01:59 PDT

Eirikur Hallgrimsson <> writes:
> [ 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.

What does "won't copy hidden files" mean? cp -a seems to copy .foo
files fine for me. Is there another kind of "hidden"?

> 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 -

I think that should be
tar -c -- "$1" | tar -C "$2" -xvf -

or directory names beginning with - or containing shell special
characters (notably space) will cause you a certain amount of grief.

What does this do that cp -a doesn't, though? Presumably if you have
GNU tar (and thus -C) you have GNU cp too. (cp -a will also usually
copy sparse files correctly, and tar won't.)

This archive was generated by hypermail 2b29 : Sun Apr 29 2001 - 20:25:22 PDT