A list of File Names from a folder

could you please tell me how to a list of File Names from a folder owned by somebody else?

@spanct

Str[] var1 = Directory.GetFiles(InputFolderPath)

Please find attached workflow

Example.zip (30.7 KB)

hey

try with this please

image

regards!

@spanct Once you read the files into the variable you can use loop to get each file name

Capture

Use workflow for ref

Example.zip (30.7 KB)

thanks for your help, I will look into this

where can i find “For Each File in Folder” activity? thanks!

hey

in the activities panel
image

regards

Hi
After using For Each File in Folder , I am extracting all the file name.?( like test.cs)
Now I need to open this .cs file and make modifications.

Thanks in advance.

I suggest using System.IO.DirectoryInfo.GetFiles instead of Directory.GetFiles.

DirectoryInfo gives you all info about the files, but Directory.GetFiles gives you only the path and filename.

System.IO.DirectoryInfo(folderPath).GetFiles(file filter)

This gives you an IEnumerable(of FileInfo) so then you can For Each to loop through it. You’d get the full path and filename with CurrentItem.FullName, or just the filename with CurrentItem.Name (you can also get the extension, last modified date, creation date, etc from the CurrentItem object).

Also, there’s no reason to create a variable and store the GetFiles output in it, then For Each through the variable. You can just put the System.IO.DirectoryInfo (or Directory.GetFiles)… expression directly into the For Each