This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cp can't hardlink unqualified wildcard


On 10/20/2012 12:50 PM, Lawrence Mayer wrote:
> Cp can't hardlink unqualified wildcard
> 
> cp -l * DIRECTORY
> 
> fails with error 'cp: target `file' is not a directory'

Most likely, this is not an error in cp, but a misunderstanding on your
part about how globbing operates.  I bet you have a file in your current
directory whose name starts with '-', and is thus being treated as an
option by cp.

> 
> But the equivalent
> 
> cp -l ./* DIRECTORY

No, that's not quite equivalent - it guarantees that the glob won't be
mis-handled as an option.  Likewise,

cp -l -- * DIRECTORY

will avoid treating the glob as an option.  Not only that, but this is a
FAQ:
https://www.gnu.org/software/coreutils/faq/#I-have-a-file-_0027_002df_0027-and-it-affects-rm_002e

> 
> AND
> 
> cp -l PATH OF WORKING DIRECTORY/* DIRECTORY

Sorry, but that's not what you typed.  It helps to show actual examples
when claiming you have a bug.


-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]