Copying a file with a question mark in it's name in Windows

Tim Golden mail at timgolden.me.uk
Thu Aug 12 08:11:33 EDT 2010


On 12/08/2010 12:49, drodrig wrote:
> A python script I use to backup files on a Windows 2003 server
> occasionally fails to retrieve the size of a file with a question mark
> in the name. The exception I get is "OSError #123 The filename,
> directory name, or volume label syntax is incorrect". I realize that
> technically a question mark in the name of a file on Windows is
> illegal, but nevertheless these files exist on the file system. It
> seems that they are created by Office 2007 Word, for the most part.

Could you show us the script you're using? I'm not aware of any
way to get a question mark into a file name; even using the
file namespace prefix \\?\ doesn't allow it as far as I can tell.

Where are you seeing the question mark? Is it possible it's a
placeholder for an unprintable character rather than an actual
question mark?

TJG



More information about the Python-list mailing list