wildcards don't work in directory with files with odd characters

jeff jeff@jeffunit.com
Mon May 18 18:10:21 GMT 2020


On 5/18/2020 11:03 AM, Adam Dinwoodie wrote:
> On Mon, 18 May 2020 at 17:21, jeff wrote:
>> On 5/18/2020 8:55 AM, Andrey Repin wrote:
>>> Greetings, jeff!
>>>
>>>> I have a directory that has some files with odd files.
>>>> I can do a 'ls', successfully. However if I do a 'ls *'' I get:
>>>> ls: cannot access '*': No such file or directory
>>>> Here is ls output:
>>>> 'Highlander-S03E21-Final'$'\303\251''_Part_I-22.mkv'
>>>> 'Highlander-S03E22-Final'$'\303\251''_Part_II-23.mkv'
>>>> I am pretty sure this used to work.
>>>> This is not specific to ls. wc has the same behavior for example.
>>> Are you trying to run it from Cygwin shell or from some native one, like cmd?
>>>
>> I am running from windows 'command prompt' aka cmd. When run from bash
>> everything seems to work correctly.
> In which case this is expected behaviour: Cygwin's `ls` expects the
> shell (e.g. Bash) to expand globs like `*`, but Windows' command
> prompt expects applications to handle expanding globs (or the Windows
> equivalents thereof) themselves. When you call a Cygwin command like
> `ls` directly from the Windows command prompt, Windows passes the
> arguments as-is to the Cygwin command, and the Cygwin command assumes
> that the arguments it received are already appropriately expanded.
>
> If this was working previously, I can only assume it's because you
> were calling Windows' `ls` (which I seem to recall exists and is
> essentially an alias for `dir`), which expects Windows semantics and
> therefore handles its own expansions.
If the directory doesn't contain any files with odd characters in the 
name, then
'ls *' run from cmd works just fine. Only when there are odd characters 
in the file name is there an issue.

thanks,
jeff




More information about the Cygwin mailing list