D
dibblm
I have a text file being created and need the values from the array that
gets created to populate my text file. I am new and not very good. Kinda
borrowing bits and pieces from here and there, so if my code is a mess
(Which it is ) don't be alarmed.
Myfile is the array that gets populated and I need it's results returned
to the text file .
Below is the code...
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
Dim folderpath As String ' Path to users folders.
Dim dirpath, adir, sdir, testpath, myfile
Me.txt1.Text = "Starting search now."
Me.Button2.Text = "Running!"
oWrite = oFile.CreateText("C:\sample.txt") ' Creates the file to write
results to.
dirpath = "J:\" ' Sets the root Directory.
adir = Directory.GetDirectories(dirpath) 'Get the Directories under the root
of "Dirpath"
Try
For Each folderpath In adir
sdir = Path.GetFileName(folderpath) & "\Cookies" 'Sets the folder to look in
the cookies folder.
TESTPATH = (dirpath & sdir)
Me.txt1.Text = (sdir)
myfile = Directory.GetFiles(TESTPATH)
Debug.WriteLine(myfile)
oWrite.WriteLine(sdir, myfile)
Next
oWrite.Close()
MsgBox("Im done")
Catch ex As Exception
MessageBox.Show("ERROR: " & ex.ToString())
End Try
Me.Button2.Text = "Start!"
gets created to populate my text file. I am new and not very good. Kinda
borrowing bits and pieces from here and there, so if my code is a mess
(Which it is ) don't be alarmed.
Myfile is the array that gets populated and I need it's results returned
to the text file .
Below is the code...
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
Dim folderpath As String ' Path to users folders.
Dim dirpath, adir, sdir, testpath, myfile
Me.txt1.Text = "Starting search now."
Me.Button2.Text = "Running!"
oWrite = oFile.CreateText("C:\sample.txt") ' Creates the file to write
results to.
dirpath = "J:\" ' Sets the root Directory.
adir = Directory.GetDirectories(dirpath) 'Get the Directories under the root
of "Dirpath"
Try
For Each folderpath In adir
sdir = Path.GetFileName(folderpath) & "\Cookies" 'Sets the folder to look in
the cookies folder.
TESTPATH = (dirpath & sdir)
Me.txt1.Text = (sdir)
myfile = Directory.GetFiles(TESTPATH)
Debug.WriteLine(myfile)
oWrite.WriteLine(sdir, myfile)
Next
oWrite.Close()
MsgBox("Im done")
Catch ex As Exception
MessageBox.Show("ERROR: " & ex.ToString())
End Try
Me.Button2.Text = "Start!"