SlideShare a Scribd company logo
System Information
 System Information
 Get Drive information in current system
 Get info of specific Drive
 Available Free Space
 DriveFormat
 IsReady
 Name
 RootDirectory
 TotalFreeSpace
 TotalSize
 VolumeLabel
 List Drive
 List Sub folders
 List Files


 System.IO.FileInfo
 Provides properties and instance methods for the creation, copying,
deletion, moving, and opening of files, and aids in the creation
of FileStream objects. This class cannot be inherited.
 System.IO.DirectoryInfo
 Exposes instance methods for creating, moving, and enumerating
through directories and subdirectories. This class cannot be
inherited.
 System.IO.DriveInfo
 Provides access to information on a drive.
 System.IO.Directory
 Exposes static methods for creating, moving, and enumerating
through directories and subdirectories. This class cannot be
inherited.
 Public Attributes
 Gets or sets the attributes for the current file or directory.
(Inherited from FileSystemInfo.)
 Public CreationTime
 Gets or sets the creation time of the current file or directory.
(Inherited from FileSystemInfo.)
 Public property CreationTimeUtc
 Gets or sets the creation time, in coordinated universal time
(UTC), of the current file or directory. (Inherited from
FileSystemInfo.)
 Public Directory
 Gets an instance of the parent directory.
 Public DirectoryName
 Gets a string representing the directory's full path.
 Public Exists
 Gets a value indicating whether a file exists. (Overrides
FileSystemInfo.Exists.)
 Public Extension
 Gets the string representing the extension part of the file.
(Inherited from FileSystemInfo.)
 Public FullName
 Gets the full path of the directory or file. (Inherited from
FileSystemInfo.)
 Public property IsReadOnly
 Gets or sets a value that determines if the current file is read
only.
 Public LastAccessTime
 Gets or sets the time the current file or directory was last
accessed. (Inherited from FileSystemInfo.)
 Public property LastAccessTimeUtc
 Gets or sets the time, in coordinated universal time (UTC),
that the current file or directory was last accessed. (Inherited
from FileSystemInfo.)
 Public LastWriteTime
 Gets or sets the time when the current file or directory was last
written to. (Inherited from FileSystemInfo.)
 Public property LastWriteTimeUtc
 Gets or sets the time, in coordinated universal time (UTC),
when the current file or directory was last written to.
(Inherited from FileSystemInfo.)
 Public Length
 Gets the size, in bytes, of the current file.
 Public Name
 Gets the name of the file. (Overrides FileSystemInfo.Name.)
DirectoryInfo Class
 Exposes instance methods for creating, moving, and
enumerating through directories and subdirectories.
This class cannot be inherited.
 Properties
 Public property Attributes
 Gets or sets the attributes for the current file or directory.
(Inherited from FileSystemInfo.)
 Public property CreationTime
 Gets or sets the creation time of the current file or directory.
(Inherited from FileSystemInfo.)
 Public property CreationTimeUtc
 Gets or sets the creation time, in coordinated universal time
(UTC), of the current file or directory. (Inherited from
FileSystemInfo.)
 Public Exists
 Gets a value indicating whether the directory exists.
(Overrides FileSystemInfo.Exists.)
 Public Extension
 Gets the string representing the extension part of the file.
(Inherited from FileSystemInfo.)
 Public FullName
 Gets the full path of the directory or file. (Inherited from
FileSystemInfo.)
 Public LastAccessTime
 Gets or sets the time the current file or directory was last
accessed. (Inherited from FileSystemInfo.)
 Public LastAccessTimeUtc
 Gets or sets the time, in coordinated universal time (UTC),
that the current file or directory was last accessed. (Inherited
from FileSystemInfo.)
 Public LastWriteTime
 Gets or sets the time when the current file or directory was
last written to. (Inherited from FileSystemInfo.)
 Public property LastWriteTimeUtc
 Gets or sets the time, in coordinated universal time (UTC),
when the current file or directory was last written to.
(Inherited from FileSystemInfo.)
 Public Name
 Gets the name of this DirectoryInfo instance. (Overrides
FileSystemInfo.Name.)
 Public Parent
 Gets the parent directory of a specified subdirectory.
 Public Root
 Gets the root portion of the directory.
System.IO.DriveInfo
 Public property AvailableFreeSpace
 Indicates the amount of available free space on a drive, in
bytes.
 Public property DriveFormat
 Gets the name of the file system, such as NTFS or FAT32.
 Public property DriveType
 Gets the drive type, such as CD-ROM, removable, network,
or fixed.
 Public property IsReady
 Gets a value that indicates whether a drive is ready.
 Public property Name
 Gets the name of a drive, such as C:.
 Public property RootDirectory
 Gets the root directory of a drive.
 Public property TotalFreeSpace
 Gets the total amount of free space available on a drive, in
bytes.
 Public property TotalSize
 Gets the total size of storage space on a drive, in bytes.
 Public property VolumeLabel
 Gets or sets the volume label of a drive.
Methods DriveInfo and Example
 GetDrives()
Retrieves the drive names of all logical drives on a
computer.
Directory Class
 Methods
 Delete(String)
 Deletes an empty directory from a specified path.
 Exists()
 Determines whether the given path refers to an existing directory
on disk.
 GetAccessControl(String)
 Gets a DirectorySecurity object that encapsulates the access
control list (ACL) entries for a specified directory
 GetCurrentDirectory()
 Returns the names of subdirectories (including their paths) in the
specified directory.
Example of Drive Info
public static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" File type: {0}", d.DriveType);
if (d.IsReady == true)
{
Console.WriteLine(" Volume label: {0}", d.VolumeLabel);
Console.WriteLine(" File system: {0}", d.DriveFormat);
Console.WriteLine(
" Available space to current user:{0, 15} bytes",
d.AvailableFreeSpace);
Console.WriteLine(
" Total available space: {0, 15} bytes",
d.TotalFreeSpace);
Console.WriteLine(
" Total size of drive: {0, 15} bytes ",
d.TotalSize);
}
}
System.Console.ReadLine();
}
Drive C:
File type: Fixed
Volume label: Windows
File system: NTFS
Available space to current user: 135662944256 bytes
Total available space: 135662944256 bytes
Total size of drive: 320070479872 bytes
Drive D:
File type: CDRom
Drive Q:
File type: Fixed
 Example of File info
 Total PhysicalMemory example

More Related Content

PDF
Unit 12 finding and processing files
PPTX
Access control list acl - permissions in linux
PPT
06 users groups_and_permissions
PDF
Unit3 browsing the filesystem
PPTX
File permission in linux
PPTX
Introduction to linux day3
PPTX
Filepermissions in linux
PPT
Linux files and file permission
Unit 12 finding and processing files
Access control list acl - permissions in linux
06 users groups_and_permissions
Unit3 browsing the filesystem
File permission in linux
Introduction to linux day3
Filepermissions in linux
Linux files and file permission

What's hot (13)

DOCX
Advanced file permissions in linux
PPTX
File permissions
PPT
Java 7 - short intro to NIO.2
PPT
Linux ppt
PPT
intro unix/linux 09
PDF
Linux commands cheat sheet by linoxide.com
PDF
Linux command line cheatsheet
PPT
Oop lecture9 11
PPTX
Find and locate
PPTX
Techniques for Cross Platform .NET Development
PDF
Linux cheat-sheet
TXT
TXT
Applecmdlista zs
Advanced file permissions in linux
File permissions
Java 7 - short intro to NIO.2
Linux ppt
intro unix/linux 09
Linux commands cheat sheet by linoxide.com
Linux command line cheatsheet
Oop lecture9 11
Find and locate
Techniques for Cross Platform .NET Development
Linux cheat-sheet
Applecmdlista zs
Ad

Viewers also liked (17)

PDF
8 Open HT, 2005, 68.966 € For Sale Yacht Brochure. Presented By longitude64.ch
PPT
8 lezionex
PDF
8-MK-Electric Switch Boards.PDF
PDF
SMART CITIES - Mobilità, Logistica ed Energia
DOC
8 r angi no5 medeelliin proces
PPT
8 erfin blok 13
PDF
8th alg -l1.7
PDF
8th alg -l9.2
DOC
8th grade reading syllabus
PPTX
8 Inspiring Quotes on Ideas for Entepreneurs
PDF
L'Opinion - Sondage Jour du Vote - Élections départementales 2015 - Sur quels...
PPT
Лекція 8 iso 9000
DOCX
홍콩침례대학 빅데이터 웹보메트릭스 특강 8 may 2015
PDF
8.tallerpractico10 mel 1
PPS
8º pentecoste 2015 ciclo b
8 Open HT, 2005, 68.966 € For Sale Yacht Brochure. Presented By longitude64.ch
8 lezionex
8-MK-Electric Switch Boards.PDF
SMART CITIES - Mobilità, Logistica ed Energia
8 r angi no5 medeelliin proces
8 erfin blok 13
8th alg -l1.7
8th alg -l9.2
8th grade reading syllabus
8 Inspiring Quotes on Ideas for Entepreneurs
L'Opinion - Sondage Jour du Vote - Élections départementales 2015 - Sur quels...
Лекція 8 iso 9000
홍콩침례대학 빅데이터 웹보메트릭스 특강 8 may 2015
8.tallerpractico10 mel 1
8º pentecoste 2015 ciclo b
Ad

Similar to 8.C# (20)

PPT
Chapter 10 - File System Interface
PPT
file management_osnotes.ppt
PDF
Intake 38 10
PDF
Intake 37 11
PDF
WhatsNewNIO2.pdf
PPT
Ch11 OS
 
PPT
PDF
PDF
My History
PPTX
Filesth file handling in language dile
PPT
File Management.ppt
PDF
CH11.pdf
PPT
DOCX
File system interfacefinal
PPT
NIO.2, the I/O API for the future
PPTX
Unix / Linux Operating System introduction.
PPT
Chapter 5 Class File
PPT
Distributed System by Pratik Tambekar
PPTX
Chapter 2 Linux File System and net.pptx
Chapter 10 - File System Interface
file management_osnotes.ppt
Intake 38 10
Intake 37 11
WhatsNewNIO2.pdf
Ch11 OS
 
My History
Filesth file handling in language dile
File Management.ppt
CH11.pdf
File system interfacefinal
NIO.2, the I/O API for the future
Unix / Linux Operating System introduction.
Chapter 5 Class File
Distributed System by Pratik Tambekar
Chapter 2 Linux File System and net.pptx

More from Raghu nath (20)

PPTX
Mongo db
PDF
Ftp (file transfer protocol)
PDF
MS WORD 2013
PDF
Msword
PDF
Ms word
PDF
Javascript part1
PDF
Regular expressions
PDF
Selection sort
PPTX
Binary search
PPTX
JSON(JavaScript Object Notation)
PDF
Stemming algorithms
PPTX
Step by step guide to install dhcp role
PPTX
Network essentials chapter 4
PPTX
Network essentials chapter 3
PPTX
Network essentials chapter 2
PPTX
Network essentials - chapter 1
PPTX
Python chapter 2
PPTX
python chapter 1
PPTX
Linux Shell Scripting
PPTX
Mongo db
Ftp (file transfer protocol)
MS WORD 2013
Msword
Ms word
Javascript part1
Regular expressions
Selection sort
Binary search
JSON(JavaScript Object Notation)
Stemming algorithms
Step by step guide to install dhcp role
Network essentials chapter 4
Network essentials chapter 3
Network essentials chapter 2
Network essentials - chapter 1
Python chapter 2
python chapter 1
Linux Shell Scripting

Recently uploaded (20)

PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
August Patch Tuesday
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
Machine Learning_overview_presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Tartificialntelligence_presentation.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Mushroom cultivation and it's methods.pdf
MIND Revenue Release Quarter 2 2025 Press Release
August Patch Tuesday
A comparative study of natural language inference in Swahili using monolingua...
Machine Learning_overview_presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
Spectroscopy.pptx food analysis technology
Tartificialntelligence_presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Heart disease approach using modified random forest and particle swarm optimi...
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
TLE Review Electricity (Electricity).pptx
Mushroom cultivation and it's methods.pdf

8.C#

  • 2.  System Information  Get Drive information in current system  Get info of specific Drive  Available Free Space  DriveFormat  IsReady  Name  RootDirectory  TotalFreeSpace  TotalSize  VolumeLabel  List Drive  List Sub folders  List Files  
  • 3.  System.IO.FileInfo  Provides properties and instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects. This class cannot be inherited.  System.IO.DirectoryInfo  Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.  System.IO.DriveInfo  Provides access to information on a drive.  System.IO.Directory  Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
  • 4.  Public Attributes  Gets or sets the attributes for the current file or directory. (Inherited from FileSystemInfo.)  Public CreationTime  Gets or sets the creation time of the current file or directory. (Inherited from FileSystemInfo.)  Public property CreationTimeUtc  Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory. (Inherited from FileSystemInfo.)
  • 5.  Public Directory  Gets an instance of the parent directory.  Public DirectoryName  Gets a string representing the directory's full path.  Public Exists  Gets a value indicating whether a file exists. (Overrides FileSystemInfo.Exists.)
  • 6.  Public Extension  Gets the string representing the extension part of the file. (Inherited from FileSystemInfo.)  Public FullName  Gets the full path of the directory or file. (Inherited from FileSystemInfo.)  Public property IsReadOnly  Gets or sets a value that determines if the current file is read only.
  • 7.  Public LastAccessTime  Gets or sets the time the current file or directory was last accessed. (Inherited from FileSystemInfo.)  Public property LastAccessTimeUtc  Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed. (Inherited from FileSystemInfo.)  Public LastWriteTime  Gets or sets the time when the current file or directory was last written to. (Inherited from FileSystemInfo.)
  • 8.  Public property LastWriteTimeUtc  Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to. (Inherited from FileSystemInfo.)  Public Length  Gets the size, in bytes, of the current file.  Public Name  Gets the name of the file. (Overrides FileSystemInfo.Name.)
  • 9. DirectoryInfo Class  Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.  Properties
  • 10.  Public property Attributes  Gets or sets the attributes for the current file or directory. (Inherited from FileSystemInfo.)  Public property CreationTime  Gets or sets the creation time of the current file or directory. (Inherited from FileSystemInfo.)  Public property CreationTimeUtc  Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory. (Inherited from FileSystemInfo.)
  • 11.  Public Exists  Gets a value indicating whether the directory exists. (Overrides FileSystemInfo.Exists.)  Public Extension  Gets the string representing the extension part of the file. (Inherited from FileSystemInfo.)  Public FullName  Gets the full path of the directory or file. (Inherited from FileSystemInfo.)
  • 12.  Public LastAccessTime  Gets or sets the time the current file or directory was last accessed. (Inherited from FileSystemInfo.)  Public LastAccessTimeUtc  Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed. (Inherited from FileSystemInfo.)  Public LastWriteTime  Gets or sets the time when the current file or directory was last written to. (Inherited from FileSystemInfo.)
  • 13.  Public property LastWriteTimeUtc  Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to. (Inherited from FileSystemInfo.)  Public Name  Gets the name of this DirectoryInfo instance. (Overrides FileSystemInfo.Name.)  Public Parent  Gets the parent directory of a specified subdirectory.  Public Root  Gets the root portion of the directory.
  • 14. System.IO.DriveInfo  Public property AvailableFreeSpace  Indicates the amount of available free space on a drive, in bytes.  Public property DriveFormat  Gets the name of the file system, such as NTFS or FAT32.  Public property DriveType  Gets the drive type, such as CD-ROM, removable, network, or fixed.
  • 15.  Public property IsReady  Gets a value that indicates whether a drive is ready.  Public property Name  Gets the name of a drive, such as C:.  Public property RootDirectory  Gets the root directory of a drive.
  • 16.  Public property TotalFreeSpace  Gets the total amount of free space available on a drive, in bytes.  Public property TotalSize  Gets the total size of storage space on a drive, in bytes.  Public property VolumeLabel  Gets or sets the volume label of a drive.
  • 17. Methods DriveInfo and Example  GetDrives() Retrieves the drive names of all logical drives on a computer.
  • 18. Directory Class  Methods  Delete(String)  Deletes an empty directory from a specified path.  Exists()  Determines whether the given path refers to an existing directory on disk.  GetAccessControl(String)  Gets a DirectorySecurity object that encapsulates the access control list (ACL) entries for a specified directory  GetCurrentDirectory()  Returns the names of subdirectories (including their paths) in the specified directory.
  • 19. Example of Drive Info public static void Main() { DriveInfo[] allDrives = DriveInfo.GetDrives(); foreach (DriveInfo d in allDrives) { Console.WriteLine("Drive {0}", d.Name); Console.WriteLine(" File type: {0}", d.DriveType); if (d.IsReady == true) { Console.WriteLine(" Volume label: {0}", d.VolumeLabel); Console.WriteLine(" File system: {0}", d.DriveFormat); Console.WriteLine( " Available space to current user:{0, 15} bytes", d.AvailableFreeSpace); Console.WriteLine( " Total available space: {0, 15} bytes", d.TotalFreeSpace); Console.WriteLine( " Total size of drive: {0, 15} bytes ", d.TotalSize); } } System.Console.ReadLine(); }
  • 20. Drive C: File type: Fixed Volume label: Windows File system: NTFS Available space to current user: 135662944256 bytes Total available space: 135662944256 bytes Total size of drive: 320070479872 bytes Drive D: File type: CDRom Drive Q: File type: Fixed
  • 21.  Example of File info  Total PhysicalMemory example