Directory.GetFiles(tempFolder,“*.jpg”,SearchOption.AllDirectories)
How to pass multiple file extension in directory.getfiles.
I used this also
Directory.GetFiles(tempFolder, “.”, SearchOption.AllDirectories).Where(Function(s) s.EndsWith(“.jpg”) Or s.EndsWith(“.jpeg”))
But getting error
Varaible used
supriya117
(Supriya Allada)
2
Hi @Puneet_Singh1
Try this:
extensions = {".txt", ".csv", ".xlsx"}
files = Directory.GetFiles("C:\FolderPath", "*.*", SearchOption.AllDirectories).Where(Function(f) extensions.Contains(Path.GetExtension(f)))
Regards,
rlgandu
(Rajyalakshmi Gandu)
3
Hi,
Take a list or array of extensions and then try to loop these extensions in for loop.
I hope this helps
Anil_G
(Anil Gorthi)
4
@Puneet_Singh1
Please try this
Directory.GetFiles("FolderPath","*",SearchOption.AllDirectories).Where(function(x) x.ToLower.EndsWith(".jpg") Or x.ToLower.EndsWith(".jpeg")).ToArray
basically .ToArray needs to be used
cheers
Extension is list type right
supriya117
(Supriya Allada)
6
No, its an array of string.
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.