What characters are forbidden in Windows and Linux directory names?

前端 未结 17 2583
北海茫月
北海茫月 2020-11-22 01:05

I know that / is illegal in Linux, and the following are illegal in Windows (I think) * . \" / \\ [

17条回答
  •  广开言路
    2020-11-22 01:44

    As of 18/04/2017, no simple black or white list of characters and filenames is evident among the answers to this topic - and there are many replies.

    The best suggestion I could come up with was to let the user name the file however he likes. Using an error handler when the application tries to save the file, catch any exceptions, assume the filename is to blame (obviously after making sure the save path was ok as well), and prompt the user for a new file name. For best results, place this checking procedure within a loop that continues until either the user gets it right or gives up. Worked best for me (at least in VBA).

提交回复
热议问题