Vb.net receives the directory list in the specific directory and saves it in a file.txt -
i need create list of existing directory names in specific folder
dim workslist string = application.startuppath + "\db\works.txt" slctextbox_baseworksdirectory = "c:\listdirectory" if my.computer.filesystem.directoryexists(slctextbox_baseworksdirectory.text) saves existing directory names slctextbox_baseworksdirectory.text (c:\listdirectory) in workslist (works.txt) end if
file works.txt
adirectory1
bdirectory2
cdirectory3
ddirectory4
edirectory5
fdirectory6
gdirectory7
to print existing directories of specific directory file, retrieve files using getdirectories
, print using appendalllines
. can replace my.computer.filesystem.specialdirectories.mydocuments
path directory want list.
dim directories = my.computer.filesystem.getdirectories(my.computer.filesystem.specialdirectories.mydocuments) io.file.appendalllines(workslist, directories.select(function(f) f.substring(f.lastindexof("\") + 1)))
this assumes workslist points valid existing text file.
Comments
Post a Comment