Questions tagged [getfiles]
266 questions
-1
votes
2 answers
How to GetFiles from multiple different paths
Can we get files from different location using some Built-In Function in C# without any loop. Like if I have following paths
C:\Folder1
C:\abc\Folder2
D:\Folder3
I want to get all files from Folder1, Folder2 and Folder3 at same time without using…

Dodhytech
- 1
- 3
-1
votes
1 answer
C# fail to create file in directory if has other file
Can someone help me, I just learning C# for about 2 month, I have this problem,
i'm building a class for filter data from temp file and create the result in new txt file inside directory, if directory is empty nor at the same date, it build…

user3641945
- 1
- 1
-1
votes
2 answers
Error when using Directory.GetFiles() with regex
I'm working on search function for my self-made Windows Explorer. I use Directory.GetFiles(string path, string searchPattern, searchOption searchOption) to do that. My problem is that when I call:
string searchPattern = '"' + searchBox.Text + '"';…

sonlexqt
- 6,011
- 5
- 42
- 58
-1
votes
1 answer
Undocumented exceptions in the .NET Framework
Once again, I'm struggling to understand an undocumented behavior of the method GetFiles in System.IO.Directory (this is going to make me crazy). While running some routine tests, I found out to my surprise that a call to this method was throwing an…

GOTO 0
- 42,323
- 22
- 125
- 158
-2
votes
1 answer
c# find all filenames in directory that contain a value specified in list/array/datatable etc
Using c# .NET 4.6.1 I have a group of strings I want to use to select "valid" files from a given directory. Here's what I mean:
Here is an example of the strings I want to use to get expected filenames from a directory that are stored in an array. I…
user7789299
-2
votes
1 answer
Need to get files based on name and age
I'm looking for a way to specifically GetFiles that have a specific name AND that have been created within a certain time limit, however I can't figure out how to use both criteria in the same statement, or to find another method to accomplish…

user9175041
- 29
- 9
-2
votes
3 answers
Get files from web directory
I wanted to just get random Images from http://random.cat/, so I wanted to index them using Directory.GetFiles or something like that, but this doesn't work. So what would be the best way to get the functionality of Directory.GetFiles but for…

LordOsslor
- 13
- 1
- 7
-2
votes
1 answer
GetFiles with spaces in filename
I use the following code to take all the files from a directory and search for a specific file:
string [] fileEntries = Directory.GetFiles("C:\\uploads");
foreach(string fileName in fileEntries)
if (fileName.Contains(name))
PicturePath…

Radu Stanescu
- 37
- 1
- 3
- 10
-2
votes
2 answers
VB.NET: GetFiles() in Specific Directory
Currently the line of code looks like this:
Dim files() As String = System.IO.Directory.GetFiles(path, filehead & ".*.*.fsi")
Dim seqfsi() As Integer
ReDim seqfsi(files.GetUpperBound(0))
Dim args() As String
Dim file As String = ""
For Each file In…

Commmett
- 39
- 1
- 1
- 8
-2
votes
3 answers
Directory.GetFiles string gives an error
I am creating a website using asp.net and c#
I need to access all files one by one in a directory. So I wrote the following code.
string[] ssImgs = Directory.GetFiles("images/movies");
Label1.Text = ssImgs[0];
Label2.Text =…

LIH
- 933
- 2
- 10
- 25
-3
votes
3 answers
how to get the newest created file in a directory using only GetFiles in System.IO Namespace in C#
I would like to create a method which returns me the newest created file in a Directory in C#
with the preferred usage of the Directory.GetFiles() method in the System.IO Namespace. Maybe it's possible to do it also without LINQ to keep it…

feedwall
- 1,473
- 7
- 28
- 48