tagged [filenames]
Obtaining only the filename when using OpenFileDialog property "FileName"
Obtaining only the filename when using OpenFileDialog property "FileName" I am trying to include only the filename of the file I've selected in the OpenFileDialog in the label1.Text property, but I ha...
- Modified
- 9 Apr at 23:8
Convert DateTime.Now to a valid Windows filename
Convert DateTime.Now to a valid Windows filename I have had this issue quite a few times and have just been using a workaround but thought I would ask here in case there is an easier option. When I ha...
Turn a string into a valid filename?
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...
Given a filesystem path, is there a shorter way to extract the filename without its extension?
Given a filesystem path, is there a shorter way to extract the filename without its extension? I program in WPF C#. I have e.g. the following path: and I want to extract `hello` from it. The path is a...
- Modified
- 4 Feb at 20:12
Build the full path filename in Python
Build the full path filename in Python I need to pass a file path name to a module. How do I build the file path from a directory name, base filename, and a file format string? The directory may or ma...
What is the best way to combine a path and a filename in C#/.NET?
What is the best way to combine a path and a filename in C#/.NET? What is the best way to combine a path with a filename? That is, given `c:\foo` and `bar.txt`, I want `c:\foo\bar.txt`. Given `c:\foo`...
DateTime.ToString() format that can be used in a filename or extension?
DateTime.ToString() format that can be used in a filename or extension? I want to add a timestamp to filenames as files are created but most of the DateTime methods I've tried output something with sp...
- Modified
- 19 Sep at 17:42
How can I replace (or strip) an extension from a filename in Python?
How can I replace (or strip) an extension from a filename in Python? Is there a built-in function in Python that would replace (or remove, whatever) the extension of a filename (if it has one)? Exampl...
How would you make a unique filename by adding a number?
How would you make a unique filename by adding a number? I would like to create a method which takes either a filename as a `string` or a `FileInfo` and adds an incremented number to the filename if t...
Directory.GetFiles doesn't pick up all files
Directory.GetFiles doesn't pick up all files I have some code that is meant to get files in a directory, which is simple enough The files are named as follows: My issue is that i
C# Filepath Recasing
C# Filepath Recasing I'm trying to write a static member function in C# or find one in the .NET Framework that will re-case a file path to what the filesystem specifies. Example: I've tried the follo
- Modified
- 28 Jan at 07:21
Sanitizing strings to make them URL and filename safe?
Sanitizing strings to make them URL and filename safe? I am trying to come up with a function that does a good job of sanitizing certain strings so that they are safe to use in the URL (like a post sl...
- Modified
- 20 Jun at 11:45
Git copy file preserving history
Git copy file preserving history I have a somewhat confusing question in Git. Lets say, I have a file `dir1/A.txt` committed and git preserves a history of commits Now I need to copy the file into `di...
Checking collision in filename search patterns with wildcards
Checking collision in filename search patterns with wildcards I need to compare file system wildcard expressions to see whether their results would overlap, by only examining/comparing the expressions...