Need help to get the file names from the folder. I am downloading multiple files in certain folder as 001,002,003…etc
So, I want to get the file name for each file downloaded. I tried using “Directory.GetFiles(path)(0)” for this I am getting the first file name as complete path “C:\Users\Downloads\001.pdf”.
But I am looking to capture only the file name like 001,002,003
The only thing you need now is to use the Path.GetFileNameWithoutExtension(item.ToString) to get only the filename and if you want to include the extension too, then replace:
Path.GetFileNameWithoutExtension(item.ToString) with Path.GetFileName(item.ToString)
This might be confusing, so i made a small sample workflow for you, please let me know if it helps:
@SenzoD
Hi Thanks for the help I tried using to assign the below to particular variable in for each loop “Path.GetFileNameWithoutExtension(item.ToString)”
I am getting an error it is not allowing me to assign to the string variable and I downloaded your Xaml file. Please find the below error
@NikhilRPA, Be careful with your naming conventions man, avoid using names like “path” to name your variables, path is a keyword in the .NET library, that is what’s causing confusion.
I renamed your path variable to FilePath and it worked.