Linked Questions

131 votes
14 answers
138k views

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 ...
user avatar
8 votes
4 answers
13k views

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 ...
Running Rabbit's user avatar
6 votes
3 answers
17k views

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 -...
gat's user avatar
  • 2,998
0 votes
2 answers
2k views

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.. ...
Nuno Valente's user avatar
0 votes
1 answer
401 views

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, ...
Barnabas's user avatar
-2 votes
1 answer
393 views

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 ...
Muhammed Irshad's user avatar
0 votes
0 answers
249 views

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 ...
Dean Movy's user avatar
  • 129
623 votes
30 answers
642k views

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 ...
Gary Willoughby's user avatar
466 votes
29 answers
324k views

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 ...
Sophie Gage's user avatar
  • 5,768
121 votes
15 answers
86k views

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 ...
M D's user avatar
  • 8,788
141 votes
11 answers
193k views

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 ...
Tobias Boschek's user avatar
111 votes
8 answers
180k views

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 ...
Pudpuduk's user avatar
  • 1,619
109 votes
7 answers
98k views

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 ...
RoflcoptrException's user avatar
67 votes
11 answers
118k views

I would like to know how to determine whether string is valid file path. The file path may or may not exist.
Diskdrive's user avatar
  • 19k
20 votes
6 answers
24k views

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. ...
ereOn's user avatar
  • 56.4k

15 30 50 per page