rename and count files

  • Thread starter Thread starter glub glub
  • Start date Start date
G

glub glub

i'm trying to make a program that works as Replace works in MS Word but this
is for use with files, not a text document.

FolderBrowserDialog1.ShowDialog()
txtPath.Text = FolderBrowserDialog1.SelectedPath

above are the 2 lines of code i have so far, i would like to display/add the
files to a list view and i feel that i would have to count the amount of
files in the specified directory to do so, so how would i count the amount
of files and add them to the list view?

i have 2 text boxes for the find and replace and button to replace, how
would i find and rename the files in the "search"?

ex (i would like to be able to search for spaces in a file name and replace
those spaces with no spaces using this program)
 
* "glub glub said:
i'm trying to make a program that works as Replace works in MS Word but this
is for use with files, not a text document.

FolderBrowserDialog1.ShowDialog()
txtPath.Text = FolderBrowserDialog1.SelectedPath

above are the 2 lines of code i have so far, i would like to display/add the
files to a list view and i feel that i would have to count the amount of
files in the specified directory to do so, so how would i count the amount
of files and add them to the list view?

i have 2 text boxes for the find and replace and button to replace, how
would i find and rename the files in the "search"?

'System.IO.Directory.GetFiles' will return an array of filenames in a
certain directory.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Improve your quoting style:
<http://learn.to/quote>
<http://www.plig.net/nnq/nquote.html>
 
ok, how would i use that though? i was thinking i would have to use a loop
to add each file to the list view or is there another way?
 
* "glub glub said:
ok, how would i use that though? i was thinking i would have to use a loop
to add each file to the list view or is there another way?

\\\
Dim s As String
For Each s In System.IO.Directory.GetFiles("C:\WINDOWS")
Dim li As New ListViewItem()
li.Text = System.IO.Path.GetFileName(s)
li.Tag = s
Me.ListView1.Items.Add(li)
Next s
///
 
Back
Top