473,386 Members | 1,758 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,386 software developers and data experts.

Count Files In A Folder

Sue
How can I count the number of files in a folder?

Thanks for all help!!

Sue
Nov 12 '05 #1
1 13372
Sue,
Try this.

Change
..Lookin = "C:\" to whatever the path to the folder is.
Change "Default Folder Name Here" to whatever folder you wish as default.
Entering the "*" as file extension in the second Input Box
will count all files, otherwise just the extension entered in the box
will be counted.

Public Sub CountFiles()

Dim fs As Object
Set fs = Application.FileSearch
With fs
.Lookin = "C:\" & InputBox("Enter Folder Name", "Folder?", "Default
Folder Name Here")
.FileName = InputBox("FileType", "*.doc, *.mdb, *.xls, *.txt, "*")
' (SortOrder:=1)ASCENDING (=2)DESCENDING
If .Execute(SortOrder:=1) > 0 Then
MsgBox "There were " & .FoundFiles.count & _
" file(s) found."
Else
MsgBox "There were no files found."
End If
End With

Set fs = Nothing

End Sub

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"Sue" <sm********@earthlik.net> wrote in message
news:jj******************@newsread1.news.atl.earth link.net...
How can I count the number of files in a folder?

Thanks for all help!!

Sue

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Glen | last post by:
As I understand it, when the first page of an application is accessed, all ASPX/ASCX/etc. files in the same folder are compiled using the JIT compiler. Is there a way to turn this feature off? ...
8
by: vinesh | last post by:
I have sample Asp.Net Web Application project. Let me know how to keep the files related to this project (like the webform.aspx, WebForm1.aspx.vb, WebForm1.aspx.resx) in a separate folder within a...
6
by: joey.powell | last post by:
I am working on a windows forms app where I need to do copies. I also need to show a progress bar. In order to be able to set the Maximum property for the progress bar and then update it during the...
3
by: umut.tabak | last post by:
Dear all, We have a multi-platform application(Windows-Linux). Linux part of our application is writing some input and trigger files on the a shared drive. What I want to do is to be able to...
2
by: MichiMichi | last post by:
My asp.net application has a directory which is filled up with over 17 files (email) a second. After a while this sums up into a huge amount of files. I usually count files with the GETFILES...
4
by: thumper5 | last post by:
i searched these forums for a file counting snippet of code to count the number of files in folder and return a value but i couldn't find one that worked. i just want to have it search the folder...
0
by: rn5a | last post by:
This is how I am creating & then reading cookies: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) 'create cookies Response.Cookies("UserName").Value = "Ron"...
1
Ali Rizwan
by: Ali Rizwan | last post by:
Hello all, I want to count no of files in a folder?? Suppose i have a folder name abc then my code count the number of files it contains. Using VB6 Thanx >> ALI <<
1
by: 7effrey | last post by:
Does anyone have a script that can count the number of files in a folder + subfolders and add it together?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.