Could rm remove files and folders with colon in their name?

Andrey Repin anrdaemon@yandex.ru
Wed Nov 10 14:49:20 GMT 2021


Greetings, Mario Emmenlauer!


> Dear All,

> I've searched if this topic has come up before but could not find it.

> 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:

> To remove everything, I can use 'find root -depth -exec rmdir \{\} \;'

> I understand that files and folders with colon in their name are illegal
> on Windows and not supported very well.

They are not necessarily illegal, it's just not well supported.

> But a number of tools manage to create (and also remove) such files. I've
> found that even the native 'del' can support this when using the UNC name
> (see for example https://serverfault.com/a/96833). It would be great if
> Cygwin could also feature this support.

> PS: These folders are created when I use the Cygwin-based build system
> for ICU (see
> https://unicode-org.github.io/icu/userguide/icu4c/build.html#how-to-build-and-install-on-windows-with-cygwin)
> For me this is in a combination with native Perl for Windows (ActivePerl,
> in my case), and using absolute build paths. After using ICU's build
> system, I can not remove the build tree anymore. It may be possible to
> solve this on the ICU side too. But their automake-and-Perl-based path
> mangling is not easily modified, and I've failed to isolate the root
> cause of the illegal paths.

Mixing Cygwin and native tools like that is prone to cause issues. In your
case, it may be more than one issue, as build system could misdetect the
platform it is building on, and such unusable paths could be the least of your
issues.


-- 
With best regards,
Andrey Repin
Wednesday, November 10, 2021 17:45:57

Sorry for my terrible english...



More information about the Cygwin mailing list