fatkatie Posted September 15, 2019 Share Posted September 15, 2019 Is there a class out there that validates window filenames? Thank you. Quote Link to comment Share on other sites More sharing options...
gw1500se Posted September 16, 2019 Share Posted September 16, 2019 (edited) What do you mean "validate?" Check that it exists and is a regular file? If so use is_file. Edited September 16, 2019 by gw1500se Quote Link to comment Share on other sites More sharing options...
fatkatie Posted September 16, 2019 Author Share Posted September 16, 2019 No, I meant validate as in a legal windows 10 file name; just the name, not a path. This validation would include length, special names and characters ... and who knows what else. Thank you. Quote Link to comment Share on other sites More sharing options...
gw1500se Posted September 16, 2019 Share Posted September 16, 2019 If I understand, you don't care if the file actually exists, you only want to know if a string represents a valid file/directory name? You could use rawurlencode and compare that result with the original string. If they are different then the original string is not a valid filename. Quote Link to comment Share on other sites More sharing options...
benanamen Posted September 16, 2019 Share Posted September 16, 2019 What is the real problem you are trying to solve by doing this? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.