By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,945 Members | 1,648 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,945 IT Pros & Developers. It's quick & easy.

rename and count files

P: n/a
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)
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
* "glub glub" <no**@none.com> scripsit:
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>
Nov 20 '05 #2

P: n/a
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?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bn*************@ID-208219.news.uni-berlin.de...
* "glub glub" <no**@none.com> scripsit:
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>

Nov 20 '05 #3

P: n/a
* "glub glub" <no**@none.com> scripsit:
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
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.