[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cp and "blah/." or "." as a source

From: Eric Blake
Subject: Re: cp and "blah/." or "." as a source
Date: Sun, 03 Dec 2006 20:39:22 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061025 Thunderbird/ Mnenhy/

Hash: SHA1

According to Zak on 12/3/2006 8:57 AM:
> Hi,
> What should happen when I copy a directory ending in "/." to another
> directory?  Like:
>     cp -a src/. dst
> This means it handles dotfiles as well - a much neater way to copy them
> than using ugly wildcards, tar, rsync, find or whatever else.  The
> documentation doesn't make it clear (to me anyway) what /should/ happen
> here, but I'd guess (wildly) that POSIX says cp should fail and do
> nothing rather than do what it does.

- -a is a GNU extension, so POSIX says nothing about how it behaves.  But
the GNU documentation ('cp --help', for instance) says it is short for cp
- -dpPR, which means it copies entire hierarchies, recursively, preserving
attributes and symlinks.  It should not matter whether you spell the
source as 'src/.' or the shorter 'src', since both spellings name the same

>  So what I'm really looking for
> here is to have the current behaviour classified one way (correct, and
> explicitly stated as the expected outcome in the docs)

Yes, the behavior you posted looks like it matches the documentation.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]