If youâ€™re code is interacting with the file system at all in Windows then you might want to think about what sort of protection you have in place for illegal characters in file names. Previously my code was checking only a handful, a handful I got from looking at the error message windows gives you when you attempt to rename a file using one of these characters.
This is but the tip of the iceberg. Instead use something like this
*Efficiency of this code not tested and probably terrible