Something like so?
[C#}
public long GetTotalFilesSize( string path)
{
DirectoryInfo di = new DirectoryInfo( path );
FileInfo[] rgFiles = di.GetFiles("*.mpg");
long totalSize=0;
foreach(FileInfo fi in rgFiles)
{
totalSize+=fi.Length;
}
return totalSize;
}
[VB.Net]
Public Function GetTotalFilesSize(path As String) As Long
Dim di As New DirectoryInfo(path)
Dim rgFiles As FileInfo() = di.GetFiles("*.mpg")
Dim totalSize As Long = 0
Dim fi As FileInfo
For Each fi In rgFiles
totalSize += fi.Length
Next fi
Return totalSize
End Function 'GetTotalFilesSize
Cheers
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"VB Programmer" wrote:
I have a videos directory with a bunch of videos in it. The video filenames
begin with the username, such as "jsmith_01.mpeg". I want to find how many
MB of video files the current user has in the videos dir. Any idea how I can
do this?
Thanks!