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

database

#1

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


#2

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


#3

Thanks @Sachin_Desai it worked :+1:

Regards
Nara


#4