SIGN UP MEMBER LOGIN:    
ARTICLE

How to Extract Files and their Information

Posted by Muhammad Shakir Articles | How do I May 03, 2010
In this article you will learn How to extract files and their information.
Reader Level:
Download Files:
 

It is very crucial to work on file system. If you are developer and developing such an application like FTP application then it becomes more crucial. You have to provide easy access to file system as "My Computer" support. If the user wants to change directory, make a new directory within directories or to be accessed files of specific directory then the application should support it.

There are many ways to develop such application which provides functionality like "My Computer". There is only difference is environment that how provides functionality to the user. There are following two mechanisms;

  1. Microsoft's VB6 component [Microsoft.VisualBasic.Compatibility.VB6]

    a. DriveListBox
    b. DirListBox
    c. FileListBox
     
  2. OpenFileDialog - This dialoag provides to access file system however you can only access one file along with full path.
     
  3.  FolderBrowserDialog - This dialog provides the user to be accessed files like "My Computer". The user gets a drive dialog and choose the appropriate folder. After selection, the user gets a full folder path which keeps all files that can be extracted using System.IO classes. The user can also be created a new folder within directories [Using in this artical].

Now, we have a folder path, so, our next task is to be extracted files and their information and display them. There are various "System.IO" classes in which I am using only two classes;

  • Directory
  • FileInfo.

Directory.GetFiles() - it is Directory class function which takes single string parameter to extract all files name along with their full path.

Then each extracted file is given "to FileInfo" object [to be initialized for each file]. The object extracts all file information. There are many properties and functions that provide file information, however, we are using only following properties;
|
.Name - Provides the file name.
.Extension - Provides the file extension as file type
.Length - Shows the file size that is long type
.CreationTime - Provides the file creation date and time.
.LastAccessTime - Provides the file last access date and time.

After extrating all information of the file, to being displayed in Listview. You can find source code as well. 

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • 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
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Gauge for SharePoint
Become a Sponsor