Counting Files in a directory with FileSystemObject

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

What I want to do is create two text fields on my form. Lets call them txtA
and txtB.

txtA needs to read the company name in txtCompany and look in the directory
"c:\mydata\" & strCompany and display the number of files in that directory.

txtB needs to open each file in that directory and count the number of lines
that begin with the word "device" (no quotes) and then display the total
number of lines that contain that string. The file it reads from will look
like this.

[General]
VAR = "123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"

Thanks in Advance
 
-----Original Message-----
What I want to do is create two text fields on my form. Lets call them txtA
and txtB.

txtA needs to read the company name in txtCompany and look in the directory
"c:\mydata\" & strCompany and display the number of files in that directory.

txtB needs to open each file in that directory and count the number of lines
that begin with the word "device" (no quotes) and then display the total
number of lines that contain that string. The file it reads from will look
like this.

[General]
VAR = "123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"

Thanks in Advance


.
What you need to do is your homework. Everything you need
to know is right in the Access help files. Read info on
file I/O, you'll soon be on your way with your project.
 
Ummm i have already done my homework enough to know to use the FSO - thats why I posted here for "help"

ZMan said:
-----Original Message-----
What I want to do is create two text fields on my form. Lets call them txtA
and txtB.

txtA needs to read the company name in txtCompany and look in the directory
"c:\mydata\" & strCompany and display the number of files in that directory.

txtB needs to open each file in that directory and count the number of lines
that begin with the word "device" (no quotes) and then display the total
number of lines that contain that string. The file it reads from will look
like this.

[General]
VAR = "123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"
Device1 ="123456789 123456789"

Thanks in Advance


.
What you need to do is your homework. Everything you need
to know is right in the Access help files. Read info on
file I/O, you'll soon be on your way with your project.
 
Back
Top