Counting files in directory

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have an ASP.Net web site that does some file system folder access. One of
the things I am doing is counting the # of files in a passed directory to
determine if I show or hide something on the page. My problem is that I
want to ignore hidden files in the count but I can't find a way to do this.
Below is my code. Can someone let me know if this is possible and how to do
it? Thanks.

David

Public Shared Function FilesInPath(ByVal strPhyPath As String) As Integer

Dim intFiles As Integer = My.Computer.FileSystem.GetFiles(strPhyPath).Count

FilesInPath = intFiles

End Function
 
to figure out hidden versus non-hidden files, you have to look at the
attributes of each file, which means you will have to loop through all files
in the directory to examine them.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
I was afraid of that. It would be nice to have something like the
"wildcard" in file search to look for attributes. Thanks.

David
 
Back
Top