As Robert pointed out on #12465, it has the undesirable property of relying on the operating system. So it would be better to use a simple rule such as checking whether the file name starts with a dot.