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

Cointains: ??? files, ??? folders

Okay, so I have some code that can do a recursive search to get the raw
number of files and folders. No big.

As a user, I can right click on any parent folder, get the properites, and
then on the general tab, the number of child files and folders are retrieved
after a few seconds. Is there any property or anything at all in VB.NET that
allows you to access THIS specific information? I'm just looking for an
alternate way to get all the child folders of a parent folder near the root
of the drive.
Oct 16 '06 #1
1 1230
Military Smurf wrote:
Okay, so I have some code that can do a recursive search to get the raw
number of files and folders. No big.

As a user, I can right click on any parent folder, get the properites, and
then on the general tab, the number of child files and folders are retrieved
after a few seconds. Is there any property or anything at all in VB.NET that
allows you to access THIS specific information? I'm just looking for an
alternate way to get all the child folders of a parent folder near the root
of the drive.
You should be able to pass in any "root" folder and get the number of
child folders and files underneath it.

Something like this:

Public Sub CountFilesAndFolders(ByVal root As String, ByRef filecount
As Integer, ByRef foldercount As Integer)
filecount = Directory.GetFiles(root, "*.*",
SearchOption.AllDirectories).Length
foldercount = Directory.GetDirectories(root, "*.*",
SearchOption.AllDirectories).Length
End Sub

Call it like this:

Private Sub Button1_Click(....) Handles Button1.Click
Dim iFileCount As Integer = 0
Dim iFolderCount As Integer = 0

CountFilesAndFolders("C:\Root Folder", iFileCount, iFolderCount)

MsgBox("Files: " & iFileCount & ", Folders: " & iFolderCount)
End Sub

HTH

Oct 17 '06 #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? ...
3
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents,...
0
MMcCarthy
by: MMcCarthy | last post by:
This is a module that scans for files and folders on a specified path and describe them in comma separated values file in a text format. The information is stored in this file consecutively like:...
1
by: semedao | last post by:
Hi all, I'm looking for some example , open source etc code that implement caching of files and folders with those requirments: 1. like every file system , I can write , read , delete etc files...
4
by: Joey | last post by:
asp.net 2/C#/VS2005 I have a web app where I use a stream writer to create a CSV (text) file. I then use my code to save the file in the site's 'App_Data' folder, in a subfolder called 'Temp'....
9
by: Lloyd Sheen | last post by:
For all those who don't think that a recursive search of files in folders is a good thing in the Microsoft.VisualBasic.FileIO.FileSystem namespace listen to this. I am reorg my mp3 collection. ...
4
by: jonathan184 | last post by:
Hi I have a perl script, basically what it is suppose to do is check a folder with files. Now the files are checked using a timestamp with the command ls -l so the timestamp in this format is...
1
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
Using .NET 2.0 is it more efficient to copy files to a single folder versus spreading them across multiple folders. For instance if we have 100,000 files to be copied, Do we copy all of them to...
0
by: samz | last post by:
Hello, Here is a simple PHP recursive file list (with interactive and visual FX) Sam's Files http://acc.jexiste.ch/JPN/RecurciveDIR12.RAR 1. How to ignore/avoid empty folders in this PHP script...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.