Linked Questions
40 questions linked to/from How do I check if a given string is a legal/valid file name under Windows?
131 votes
14 answers
138k views
In C# check that filename is *possibly* valid (not that it exists) [duplicate]
Is there a method in the System.IO namespace that checks the validity of a filename? For example, C:\foo\bar would validate and :"~-* would not Or a little trickier, X:\foo\bar would validate is ...
8 votes
4 answers
13k views
Validating a filename in c# [duplicate]
Possible Duplicate: How check if given string is legal (allowed) file name under Windows? I am new to stackoverflow. I know its a silly question, but I am stuck in it. I want to validate a ...
6 votes
3 answers
17k views
Check if a filename is valid [duplicate]
What would be the most conservative way to check if a file-name is valid in Python on all platforms (including mobile platforms like Android, iOS)? Ex. this_is_valid_name.jpg -> Valid **adad.jpg -...
0 votes
2 answers
2k views
C# remove unallowed folder name characters [duplicate]
Possible Duplicate: How check if given string is legal (allowed) file name under Windows? I have searched about, spent some minutes googling, but i cant apply what i have found, to my context.. ...
0 votes
1 answer
401 views
Check if string is Match GetInvalidFileNameChars() [duplicate]
I try to check if string is Match GetInvalidFileNameChars() i would like to use regex So i put the chars of GetInvalidFileNameChars() into a string and then check if Regex.IsMatch(id, ...
-2 votes
1 answer
393 views
Getting Exception when filename has spaces in File.WriteAllBytes() c# [duplicate]
I have to use File.WriteAllBytes() to store the file contents. If file.Filename is a string without spaces it works fine (like "abc","sample"). But if file.FileName comes with ...
0 votes
0 answers
249 views
C#: check if file is Valid file path (not exist) [duplicate]
I have simple TextBox when the user can insert File path. Now I want to validate if this File path is valid for example: c:\blabla --> this valid c: \blabla --> this Not valid I have this ...
623 votes
30 answers
642k views
How to remove illegal characters from path and filenames?
I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using ...
466 votes
29 answers
324k views
Turn a string into a valid filename?
I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python. I'd rather be strict than otherwise, so let's say I want to ...
121 votes
15 answers
86k views
Is there a way of making strings file-path safe in c#?
My program will take arbitrary strings from the internet and use them for file names. Is there a simple way to remove the bad characters from these strings or do I need to write a custom function for ...
141 votes
11 answers
193k views
Check whether a path is valid
I am just wondering: I am looking for a way to validate if a given path is valid. (Note: I do not want to check if a file is existing! I only want to proof the validity of the path - So if a file ...
111 votes
8 answers
180k views
Check if a string is a valid Windows directory (folder) path
I am trying to determine whether a string input by a user is valid for representing a path to a folder. By valid, I mean formatted properly. In my application, the folder represents an installation ...
109 votes
7 answers
98k views
Easiest way to check if an arbitrary String is a valid filename [duplicate]
In my application the user can enter a filename. Before processing I'd like to check if the input String is a valid filename on Windows Vista. Whats the easiest way to do that? By valid I'm ...
67 votes
11 answers
118k views
Determine via C# whether a string is a valid file path
I would like to know how to determine whether string is valid file path. The file path may or may not exist.
20 votes
6 answers
24k views
Check whether a string is a valid filename with Qt
Is there a way with Qt 4.6 to check if a given QString is a valid filename (or directory name) on the current operating system ? I want to check for the name to be valid, not for the file to exist. ...