Getting the name of file from a folder


How do i get the name of the file present in a particular folder.
There is single file present in a folder for single transaction.
After every transaction previous file is deleted and new file is saved to the folder at the beginning of new transaction thus folder has single file every time.


You can get all the files using Directory.GetFiles(“Path”) and store them in array.

So you can loop and get the only value you have in that folder which will give you the entire file path along with the extension

hi hareesh,

i am using the following lines of code
fileArr= Directory.getFiles(path)

here i am unnecessarily creating an array as there is just one file in the folder. is there any other way than using an array

No issues at all right? it won’t affect the workflow processing time I hope @Aishwarya_Thakur :slight_smile:

I don’t think we have an alternative