Hey Apeksha, you can try following pseudo code to resolve your issue:
for each item in directory.getfiles()
myFileInfoVar = new FileInfo(item.toString)
messagebox myFileInfoVar.Name
![image](https://aws1.discourse-cdn.com/uipath/original/2X/5/541ed63bb731d25b625ab43c567eb997e9c282c2.png)
Also, in the message box you must put test.Name (instead of test.toString). This property returns only the file name.
Let me know if this worked.