How can I get a list of all filenames into one text file?

  • Thread starter Thread starter Trint Smith
  • Start date Start date
T

Trint Smith

ok,
batch files will be written out at a certain time into one directory...i
need all of the filenames from one directory to be listed in one text
file...how can i do that??
thanks,
Trint

..Net programmer
(e-mail address removed)
 
You can use the System.Io.DirectoryInfo to get a list of files, then use a
filestream object to write out each one of their names.
 
Hello,

Trint Smith said:
batch files will be written out at a certain time into one directory...i
need all of the filenames from one directory to be listed in one text
file...how can i do that??

System.IO.DirectoryInfo.GetFiles

will return an array of strings containing the file names of the files in
the directory. Have a look at the classes FileStream and StreamWriter in
the System.IO namespace for writing the data to a file.

HTH,
Herfried K. Wagner
 
Back
Top