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
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.