How to get only File name from directory and not the complete path

hi evryone I am trying to insert all the files names from a folder to MySQL DB
but it is getting the complete path into database is there any function to get only the file name and not the complete path.
I am currently using Directory.GetFiles(“Path”)

Regards

4 Likes

Once you get all the file names with complete path, you can use a for each and then use
string fileName = Path.GetFileName(fullpathname)

Regards,
Sachin

5 Likes

Thanks @Sachin_Desai it worked :+1:

Regards
Nara

1 Like
1 Like