C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how to get all file name in folder with txt extention??


Posted Date: 13 May 2008      Total Responses: 2

Posted By: Ravindra Singh       Member Level: Gold     Points: 1


how to get all file name in folder with .txt extention using vb.net??



Responses

Author: Shivshanker Cheral    13 May 2008Member Level: DiamondRating:     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 2008Member Level: DiamondRating:     Points: 6
www.buygold.net/v02n10/v02n10.html


Post Reply
You must Sign In to post a response.
Next : VB.NET
Previous : Chat application in dot net
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

teleconferencing

Contact Us    Privacy Policy    Terms Of Use