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

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)
 
C

CJ Taylor

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

Herfried K. Wagner [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top