I am using Nim Compiler Version 0.17.2 (2017-09-10) [Windows: amd64] with MSYS2+MingW64 on Win7 64 bits.

I know test:test.txt is not a valid DOS/Windows filename. So how to detect it in code? Thanks

import os
try:
    copyFile("test.txt", "test:test.txt")
except:
    echo "not support"          # this will not happend

if existsFile("test:test.txt"):
    echo "ok"                    # this happends because a zero-byte test file is created and treated
else:
    echo "no"

the output is ok and a zero-byte test file is created

2017-09-11 05:47:34
os.copyFile uses the Windows API on Windows for copying so it inherits its problems.
2017-09-11 06:38:15
Try to test new file name for not containing disallowed symbols (<>?/\|":* and with code <32), not consisting entirely of dots and not ending with a dot, before trying to copy. If the path may contain directories chain and drive letter, change the test accodingly.
2017-09-11 07:52:25
'test:test.txt' is a valid filename for NTFS. You create a file named 'test' with additional stream 'test.txt'. See: NTFS Additional Data Streams
2017-09-11 08:26:54
From oyster's words follows that he meant usual files and considered that filename invalid, and wanted to filter out such names.
2017-09-11 14:19:33