bug-coreutils
[Top][All Lists]
Advanced

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

Re: Filename Globbing issues on Win32?


From: Eric Blake
Subject: Re: Filename Globbing issues on Win32?
Date: Mon, 09 May 2005 15:07:04 +0000

> OK, first off, I'm on Win32 (XP) using 5.3 of coreutils. 
> 
> I have been knocking my head on this and I'm feeling *really* stupid.
> I swear, I'm unix literate, but I can't seem to get the following to
> work without cheating:
> 
> cp -uvp "c:\dir with space\long path\*" k:\path

>From context, it appears you are using a Windows shell and not bash (in bash 
>double quotes, you have to spell it c:\\dir, not c:\dir, since \ is an escape 
>character).  Are you using cygwin, or some other coreutils compilation?  Since 
>the Windows shell is not POSIX compliant, you may get more help with proper 
>Windows shell quoting by asking on the mailing list of your coreutils provider 
>(if it is cygwin, try cygwin <at> cygwin.com). 

Meanwhile, read up on shell quoting - filename globbing is suppressed by 
quoting.  So "*", \*, and '*' all mean a literal *, while * outside of quotes 
gets expanded into a file list.  Your attempt quoted the *, so it was passing a 
literal * as the single filename argument to cp (and the file named * did not 
exist), rather than a list of filenames.

The following two approaches work in cygwin and both do what you appear to be 
wanting (bonus: cygwin uses unix-style paths, rather than the problematic 
backslashes, so you don't have to worry about whether it should be "c:\dir" or 
"c:\\dir" depending on Windows vs. bash shell):

cp -uvp '/cygdrive/dir with space/long path'/* /cygdrive/k/path
cp -uvp /cygdrive/c/dir\ with\ space/long\ path/* /cygdrive/k/path

--
Eric Blake






reply via email to

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