I want to get .PDF and .Tiff files in a folder. The filter works for one file type, but does not support multiple. I used syntax as File_list=Directory.GetFiles(path.ToString, “*.PDF”)
Hi!
This worked for me:
fileList = Directory.GetFiles(path.ToString, “.PDF").Union(Directory.GetFiles(path.ToString, ".tiff”)).ToArray
Hi @neethulg,
Try this - File_list=Directory.GetFiles(path.ToString, “.PDF”).Concat(Directory.GetFiles(path.ToString, “.Tiff”))
Cheers,
Avi
filteredFiles = Directory
.GetFiles(path, "*.*")
.Where(function(X) X.ToLower().EndsWith("tiff") OR X.ToLower().EndsWith("pdf"))
.ToList();
this didn’t worked for me.
This also didn’t worked for me.
was it not giving result or validation error?
no nothing is getting into the array of string. its not showing any errors but when i try to loop and display the file names i understood the files are not getting into the array, also i checked the length of the output array it is 0.
Can you send me your workflow or screen shots?
What in_TrasactionItem is having, log it and check and send me the file location and file screenshot - just check case sensitivity in their extension.
in_Transaction item is the folder location. It is working for PDF files alone. When multiple filters are applied there is problem.
Thanks. It worked the syntax was correct. the problem was in this syntax * was not mentioned before the extension , File_list=Directory.GetFiles(path.ToString, “ .PDF”).Concat(Directory.GetFiles(path.ToString, “.Tiff”))
Here is the screenshot - I am able to get both file from same folder .
I used - variable1 = Directory.GetFiles(“C:\temp”,“.csv").Concat(Directory.GetFiles(“C:\temp”,".xml”))
variable1 is type of System.Collections.generic.IEnumerable-String
oh! Anyways finally you got the solution Cheers
its not again working for PDF and tiff. Only works for PDF.
strange, did it worked once for both?
no. For both its not working. for pdf its working.