Could rm remove files and folders with colon in their name?
Mario Emmenlauer
mario@emmenlauer.de
Thu Nov 11 14:00:19 GMT 2021
On 10/11/2021 21:39, Corinna Vinschen via Cygwin wrote:
> On Nov 10 21:24, Mario Emmenlauer wrote:
>> On 10.11.21 14:49, Corinna Vinschen via Cygwin wrote:
>>> On Nov 10 10:45, Mario Emmenlauer wrote:
>>>> Could 'rm' support removing files and folders that have a colon ':' in
>>>> their name? I.e. I would like that 'rm -fr' would remove a full directory
>>>> tree, including such folders. Currently it will correctly remove anything
>>>> inside such folders, but not the folder itself.
>>>>
>>>> As an example, for the following structure:
>>>> C:/root/folder/C:/inside/file.txt
>>>>
>>>> When using 'rm -fr root', afterwards I have:
>>>> C:/root/folder/C:
>>>
>>> It works fine if the folder is called, say, "a:b", it just doesn't
>>> work for a name which looks like a drive letter "x:", apparently.
>>
>> That is indeed interesting, I was not aware of it! Then maybe the
>> problem is not so hard to solve? That would be awesome!
>
> To the contrary. The problem is the ambiguity that "X:/foo" might
> be either the absolute POSIX path $CWD/X:/foo, or the absolute DOS
> path "X:\foo". I have a patch which fixes your case, but not much
> else. The problem is that we historically allow DOS paths as input
> at all. That was a bad decision from the start, but you can't easily
> change 25 years of history...
Oh my, I see! All the more thanks for so quickly patching support for
this use case. Its highly appreciated!
All the best,
Mario
More information about the Cygwin
mailing list