473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

rename and count files

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
3 6387
* "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
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
* "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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: dudufigueiredo | last post by:
I have one folder containing mp3 files, the folder is: C:\My Shared Folder\Rubber Soul And the files are: 01 drive my car.mp3 02 norwegian wood.mp3 03 you won't see me.mp3 04 nowhere man.mp3...
3
by: Newbie | last post by:
Hello, I'm trying to rename 2000+ jpg files in a directory. all filenames are similar, so that makes it a little bit easier. They look like at123456a, at123457a, etc. What I need to do is...
5
by: Rothariger | last post by:
Hello.... i want to know if its posible to rename multiple files like windows does.. example: file zzzzzzz.doc file asdasd.doc file esfsefse.doc
2
by: AA Arens | last post by:
During my database construction, I left the names of the buttons, comboboxes named by default like Combo77, Command43. I can rename them with Properties Other Name, but them I start getting...
12
by: mantrid | last post by:
Im trying to move a file but am having luck my code is below. The temp and target paths are valid as they echo correctly. but I cant get the copy() function to work, or the rename() function ...
1
by: hardik | last post by:
can anyone tell me how i can change the filename which is going to uploaded here is a code for uploading a file <!-- #include file="clsUpload.asp" --> Set objUpload = New clsUpload If...
6
by: shuaishuaiyes | last post by:
Hello everyone... I'm a Chinese student and my English is very poor...So excuse me if I make grammar mistake. I want to ask some questions about "rename". I'm a beginner, so my C ..... :) I...
2
by: =?iso-8859-1?b?cultaQ==?= | last post by:
Hi, I would like to rename files (jpg's ones) using a text file containing the new names... Below is the code that doesn't work : ***** #!/usr/bin/python #-*- coding: utf-8 -*- from os...
1
by: achotto | last post by:
hi, i try to upload a multiple image files. after that i will rename the files name. the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.