read files from folder
-
i have a folder in my documents named skins i want to read the all files name in this folder how can do it
fatma
Take a look at the
Directory
andDirectoryInfo
class.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
i have a folder in my documents named skins i want to read the all files name in this folder how can do it
fatma
string[] files=Directory.GetFiles(skinsFolder); As a note, you will have the full path. If you only want the file name, just get a substring of the last index of '\'. Aaron
-
i have a folder in my documents named skins i want to read the all files name in this folder how can do it
fatma
as Aaron said, assign the retrived file array to a fileinfo object and use the properties to get the filename or extension. FileInfo fileinfo = new FileInfo(files[0]); long sFileSize = fileinfo.Length;(gives u the file size) fileinfo.Directory etc.......