Hi guys, i want to know the total number of files in my C:\ partition, how can i do this?
Thx all
Printable View
Hi guys, i want to know the total number of files in my C:\ partition, how can i do this?
Thx all
VB Code:
Dim x as new System.IO.DirectoryInfo("C:\") MessageBox.Show(x.GetFiles().Length.ToString())
Hi, First of all thx for reply :) but in this method i get only the number of files in C:\ directory, but i want to know all files contained in C:\ partition, the number in the subfolders too, can you help me?
You would have to write a recursive function to do that and just keep returning the sum of the number of files. It should be pretty straightforward. Just use the same method there, but you have to use the GetDirectories function of the drive to get then iterate through each of the sub directories.
It sounds complex :P but i'll try, thx :)
There's code for a recursive file search in the VB.NET Codebank forum. Note also that you may not have permission to open every folder so you would need to include exception handling for that situation and simply exclude those folders.
Yes, i use a try to log the files impossible to access, i try to search this code, Thx jmcilhinney :)
I love you :P i found it and it worked good, Thx a lot :)