SIGN UP
MEMBER LOGIN:
TECHNOLOGIES
Active Directory in VB.NET
ADO.NET in VB.NET
Algorithms and VB.NET
ASP.NET AJAX in VB.NET
ASP.NET using VB.NET
Assemblies in VB.NET
COM Interop in VB.NET
Cryptography in VB.NET
Crystal Reports in VB.NET
Database & DBA
Deployment in VB.NET
Design & Architecture
DirectX with VB.NET
Enterprise Development
Games in VB.NET
GDI+ in VB.NET
General
LINQ with VB.NET
Mobile Dev in VB.NET
Multithreading in VB.NET
Networking with VB.NET
Office and VB.NET
Printing in VB.NET
Remoting in VB.NET
Reports in VB.NET
Security in VB.NET
Silverlight using VB.NET
Speech in VB.NET
Strings, Arrays in VB.NET
Tablet PC
Tablet PC with VB.NET
VB.NET Articles
VB.NET Exception Handling
VB.NET FAQ
VB.NET How do I
VB.NET Language
VB.NET Tutorials
VB.NET Windows Service
VBA
Visual Basic 11
Visual Basic 2010
Visual Basic Language
WCF with VB.NET
Web Controls in VB.NET
Web Dev in VB.NET
Web Forms with VB.NET
Web Service in VB.NET
Windows Controls
Windows Forms VB.NET
Workflow in VB.NET
WPF using VB.NET
XAML in VB.NET
XML in VB.NET
FORUMS
BLOGS
Use of Excel.AddUnique Method in MS Excel to D ...
Use of PPT.ApplyTheme.BackgroundStyle in MS P ...
Use of PPT.InteractWithChartLocation in MS Pow ...
Simple Web Report With Pivot Table and Linq to ...
Print A Chart into a Byte Stream
Using New Audio Player Class With VB.NET
Display Top Ten Percent Item and bottom Ten pe ...
Use of PPT.ConvertTextToSmartArt in MS PowerP ...
How to Find Backup Folder Data Location Using ...
Calendar Control In WPF
ARTICLE
Implementing the Windows File System.
Posted by
Sapna
in
Articles
|
Visual Basic Language
on
July 06, 2010
Tags:
Directory.
,
File handling
,
VB.NET
In the article you will learn how to implement the Windows File System.
Tweet
606
0
0
Reader Level:
The ability to browse and locate files and directories for a specific directory is essential for many programming tasks. You can work with files and directories by using classes such as the DirectoryInfo and FileInfo classes in combination. Using theses classes is an efficient way to gather the required information about files and directories in a specific location.
The DirectoryInfo class and FileInfo class are both derived from the FileSystemInfo class.
The following code shows the use of the FileInfo class:
using
System;
using
System.IO;
namespace
File_Handling
{
class
Tester
{
public
static
void
Main()
{
//creating an instance of DirectoryInfo class
DirectoryInfo
MydirInfo =
new
DirectoryInfo
(
@"c:\WINDOWS"
);
//get all the files in the directory and print their name, and size
FileInfo
[] FileInDir = MydirInfo.GetFiles ();
foreach
(
FileInfo
file
in
FileInDir)
{
Console
.WriteLine(
"File Name:{0} size:{1} bytes"
,
file.Name, file.Length);
}
}
}
}
In the preceding code, the Getfiles() method is used to retrive the list of all the files in the directory. This displays the list of all the directories of the given location and their sizes like that:
Login
to add your contents and source code to this article
share this article :
Implementing the Windows File System.
Tags:
Directory.
,
File handling
,
VB.NET
How to Shuffle an array in Vb.Net
Tags:
Array
,
Function
,
Shuffle
,
VB.NET
Related Articles
File Tampering Detection
Browse or Open a File using VB.Net
Windows Forms FontDialog Component
SaveFileDialog in VB.NET
Copy Files from System to FTP in .NET
post comment
TOP LEADERS
View All
TRENDING UP
Use of Excel.AddUnique Method in MS Excel to Display Unique Numbers in Ranges
Use of PPT.ApplyTheme.BackgroundStyle in MS PowerPoint 2010 to Apply Themes & Backgrounds
Use of PPT.InteractWithChartLocation in MS PowerPoint 2010 to Change Chart Locations
Simple Web Report With Pivot Table and Linq to Entity
Print A Chart into a Byte Stream
Using New Audio Player Class With VB.NET
Display Top Ten Percent Item and bottom Ten percent Item
Use of PPT.ConvertTextToSmartArt in MS PowerPoint 2010 to Convert Text into SmartArt
How to Find Backup Folder Data Location Using GetSpecialLocation in MS OneNote 2010
Calendar Control In WPF
View All
Sponsored by
Become a Sponsor
MOST LIKED ARTICLE
Web based Chat application in VB.NET
Scroll text using timer in VB.NET
Input Controls in ASP.Net
Finding the first and last day of the month in VB.NET
Loading a Form Icon in VB.NET
TAG CLOUD
.NET
ADO.NET
app_themes
ASP.NET
C
C#
Database
Datagrid
Design
DirectoryServices
games
GridView
Images
jquery
MVC
Silverlight
Silverlight 5
Thread
try
tutorials
VB.NET
WCF
Windows Forms
WPF
XML
PREMIUM SPONSORS
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Sponsored by
Become a Sponsor