neuron Administrator
Posts : 38 Join date : 2009-08-06
| Subject: How to know the content of a folder and get their attributes Sat Aug 08, 2009 12:38 am | |
| code is very useful in determining not only the size but also the type of file. - Code:
-
Imports System.IO Module Module1
Sub Main()
Dim strFileSize As String = "" Dim di As New IO.DirectoryInfo("<path here with filename>") Dim aryFi As IO.FileInfo() = di.GetFiles("*.*") 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 Console.ReadLine() End Sub
End Module
| |
|