| Author: Shivshanker Cheral 13 May 2008 | Member Level: Diamond | Rating: Points: 6 |
List all files in a folder with VB.NET In .NET you can use the DirectoryInfo class of the System.IO namespace to get a list of files in a particular folder. DirectoryInfo has a GetFiles method that returns a file list, as FileInfo structures, from the specified directory. Optionally, GetFiles takes a pattern as a parameter that can limit the list of files returned.
Imports System.IO Dim strFileSize As String = "" Dim di As New IO.DirectoryInfo("C:\temp") Dim aryFi As IO.FileInfo() = di.GetFiles("*.txt") Dim fi As IO.FileInfo
For Each fi In aryFi strFileSize = (Math.Round(fi.Length / 1024)).ToString() Console.WriteLine("File Name: {0}", fi.Name) Console.WriteLine("File Full Name: {0}", fi.FullName) Console.WriteLine("File Size (KB): {0}", strFileSize ) Console.WriteLine("File Extension: {0}", fi.Extension) Console.WriteLine("Last Accessed: {0}", fi.LastAccessTime) Console.WriteLine("Read Only: {0}", (fi.Attributes.ReadOnly = True).ToString) Next
for more refer http://www.codeproject.com/KB/dotnet/folderwatcher.aspx
|
| Author: karthekeyan 13 May 2008 | Member Level: Diamond | Rating: Points: 6 |
www.buygold.net/v02n10/v02n10.html
|