SlideShare uma empresa Scribd logo
1 de 21
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

Mais conteúdo relacionado

Mais procurados

Advanced file permissions in linux
Advanced file permissions in linuxAdvanced file permissions in linux
Advanced file permissions in linux
Mohit Singh
 
Applecmdlista zs
Applecmdlista zsApplecmdlista zs
Applecmdlista zs
Ben Pope
 

Mais procurados (13)

Advanced file permissions in linux
Advanced file permissions in linuxAdvanced file permissions in linux
Advanced file permissions in linux
 
File permissions
File permissionsFile permissions
File permissions
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
intro unix/linux 09
intro unix/linux 09intro unix/linux 09
intro unix/linux 09
 
Linux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.comLinux commands cheat sheet by linoxide.com
Linux commands cheat sheet by linoxide.com
 
Linux command line cheatsheet
Linux command line cheatsheetLinux command line cheatsheet
Linux command line cheatsheet
 
Oop lecture9 11
Oop lecture9 11Oop lecture9 11
Oop lecture9 11
 
Find and locate
Find and locateFind and locate
Find and locate
 
Techniques for Cross Platform .NET Development
Techniques for Cross Platform .NET DevelopmentTechniques for Cross Platform .NET Development
Techniques for Cross Platform .NET Development
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Unix3
Unix3Unix3
Unix3
 
Applecmdlista zs
Applecmdlista zsApplecmdlista zs
Applecmdlista zs
 

Destaque

8 lezionex
8 lezionex8 lezionex
8 lezionex
imartini
 
8-MK-Electric Switch Boards.PDF
8-MK-Electric Switch Boards.PDF8-MK-Electric Switch Boards.PDF
8-MK-Electric Switch Boards.PDF
Mukund Kamdar
 
8 r angi no5 medeelliin proces
8 r angi no5 medeelliin proces8 r angi no5 medeelliin proces
8 r angi no5 medeelliin proces
shulam
 
8th alg -l1.7
8th alg -l1.78th alg -l1.7
8th alg -l1.7
jdurst65
 
8th alg -l9.2
8th alg -l9.28th alg -l9.2
8th alg -l9.2
jdurst65
 
8th grade reading syllabus
8th grade reading syllabus8th grade reading syllabus
8th grade reading syllabus
masenhimerd
 
Лекція 8 iso 9000
Лекція 8 iso 9000Лекція 8 iso 9000
Лекція 8 iso 9000
Pavlo Syrvatka
 

Destaque (17)

8 Open HT, 2005, 68.966 € For Sale Yacht Brochure. Presented By longitude64.ch
8 Open HT, 2005, 68.966 € For Sale Yacht Brochure. Presented By longitude64.ch8 Open HT, 2005, 68.966 € For Sale Yacht Brochure. Presented By longitude64.ch
8 Open HT, 2005, 68.966 € For Sale Yacht Brochure. Presented By longitude64.ch
 
8 lezionex
8 lezionex8 lezionex
8 lezionex
 
8-MK-Electric Switch Boards.PDF
8-MK-Electric Switch Boards.PDF8-MK-Electric Switch Boards.PDF
8-MK-Electric Switch Boards.PDF
 
SMART CITIES - Mobilità, Logistica ed Energia
SMART CITIES - Mobilità, Logistica ed EnergiaSMART CITIES - Mobilità, Logistica ed Energia
SMART CITIES - Mobilità, Logistica ed Energia
 
8 r angi no5 medeelliin proces
8 r angi no5 medeelliin proces8 r angi no5 medeelliin proces
8 r angi no5 medeelliin proces
 
8 erfin blok 13
8 erfin blok 138 erfin blok 13
8 erfin blok 13
 
8th alg -l1.7
8th alg -l1.78th alg -l1.7
8th alg -l1.7
 
8th alg -l9.2
8th alg -l9.28th alg -l9.2
8th alg -l9.2
 
8th grade reading syllabus
8th grade reading syllabus8th grade reading syllabus
8th grade reading syllabus
 
8 Inspiring Quotes on Ideas for Entepreneurs
8 Inspiring Quotes on Ideas for Entepreneurs8 Inspiring Quotes on Ideas for Entepreneurs
8 Inspiring Quotes on Ideas for Entepreneurs
 
L'Opinion - Sondage Jour du Vote - Élections départementales 2015 - Sur quels...
L'Opinion - Sondage Jour du Vote - Élections départementales 2015 - Sur quels...L'Opinion - Sondage Jour du Vote - Élections départementales 2015 - Sur quels...
L'Opinion - Sondage Jour du Vote - Élections départementales 2015 - Sur quels...
 
8 Marzo - Martxoaren 8a
 8 Marzo - Martxoaren 8a 8 Marzo - Martxoaren 8a
8 Marzo - Martxoaren 8a
 
8th cs and is dec 2015
8th cs and is dec 20158th cs and is dec 2015
8th cs and is dec 2015
 
Лекція 8 iso 9000
Лекція 8 iso 9000Лекція 8 iso 9000
Лекція 8 iso 9000
 
홍콩침례대학 빅데이터 웹보메트릭스 특강 8 may 2015
홍콩침례대학 빅데이터 웹보메트릭스 특강 8 may 2015홍콩침례대학 빅데이터 웹보메트릭스 특강 8 may 2015
홍콩침례대학 빅데이터 웹보메트릭스 특강 8 may 2015
 
8.tallerpractico10 mel 1
8.tallerpractico10 mel 18.tallerpractico10 mel 1
8.tallerpractico10 mel 1
 
8º pentecoste 2015 ciclo b
8º pentecoste  2015  ciclo b8º pentecoste  2015  ciclo b
8º pentecoste 2015 ciclo b
 

Semelhante a 8.C#

Ch11 OS
Ch11 OSCh11 OS
Ch11 OS
C.U
 

Semelhante a 8.C# (20)

Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.ppt
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
Intake 37 11
Intake 37 11Intake 37 11
Intake 37 11
 
WhatsNewNIO2.pdf
WhatsNewNIO2.pdfWhatsNewNIO2.pdf
WhatsNewNIO2.pdf
 
Ch11 OS
Ch11 OSCh11 OS
Ch11 OS
 
OSCh11
OSCh11OSCh11
OSCh11
 
OS_Ch11
OS_Ch11OS_Ch11
OS_Ch11
 
History
HistoryHistory
History
 
My History
My HistoryMy History
My History
 
File Management.ppt
File Management.pptFile Management.ppt
File Management.ppt
 
CH11.pdf
CH11.pdfCH11.pdf
CH11.pdf
 
Ch10
Ch10Ch10
Ch10
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
 
NIO.2, the I/O API for the future
NIO.2, the I/O API for the futureNIO.2, the I/O API for the future
NIO.2, the I/O API for the future
 
Chapter 5 Class File
Chapter 5 Class FileChapter 5 Class File
Chapter 5 Class File
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptx
 
10.file system interface
10.file system interface10.file system interface
10.file system interface
 
Operating System
Operating SystemOperating System
Operating System
 

Mais de Raghu nath

Ftp (file transfer protocol)
Ftp (file transfer protocol)Ftp (file transfer protocol)
Ftp (file transfer protocol)
Raghu nath
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
Raghu nath
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Raghu nath
 
Selection sort
Selection sortSelection sort
Selection sort
Raghu nath
 
Binary search
Binary search Binary search
Binary search
Raghu nath
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)
Raghu nath
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithms
Raghu nath
 
Step by step guide to install dhcp role
Step by step guide to install dhcp roleStep by step guide to install dhcp role
Step by step guide to install dhcp role
Raghu nath
 
Network essentials chapter 4
Network essentials  chapter 4Network essentials  chapter 4
Network essentials chapter 4
Raghu nath
 
Network essentials chapter 3
Network essentials  chapter 3Network essentials  chapter 3
Network essentials chapter 3
Raghu nath
 
Network essentials chapter 2
Network essentials  chapter 2Network essentials  chapter 2
Network essentials chapter 2
Raghu nath
 
Network essentials - chapter 1
Network essentials - chapter 1Network essentials - chapter 1
Network essentials - chapter 1
Raghu nath
 
Python chapter 2
Python chapter 2Python chapter 2
Python chapter 2
Raghu nath
 
python chapter 1
python chapter 1python chapter 1
python chapter 1
Raghu nath
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell Scripting
Raghu nath
 

Mais de Raghu nath (20)

Mongo db
Mongo dbMongo db
Mongo db
 
Ftp (file transfer protocol)
Ftp (file transfer protocol)Ftp (file transfer protocol)
Ftp (file transfer protocol)
 
MS WORD 2013
MS WORD 2013MS WORD 2013
MS WORD 2013
 
Msword
MswordMsword
Msword
 
Ms word
Ms wordMs word
Ms word
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Selection sort
Selection sortSelection sort
Selection sort
 
Binary search
Binary search Binary search
Binary search
 
JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)JSON(JavaScript Object Notation)
JSON(JavaScript Object Notation)
 
Stemming algorithms
Stemming algorithmsStemming algorithms
Stemming algorithms
 
Step by step guide to install dhcp role
Step by step guide to install dhcp roleStep by step guide to install dhcp role
Step by step guide to install dhcp role
 
Network essentials chapter 4
Network essentials  chapter 4Network essentials  chapter 4
Network essentials chapter 4
 
Network essentials chapter 3
Network essentials  chapter 3Network essentials  chapter 3
Network essentials chapter 3
 
Network essentials chapter 2
Network essentials  chapter 2Network essentials  chapter 2
Network essentials chapter 2
 
Network essentials - chapter 1
Network essentials - chapter 1Network essentials - chapter 1
Network essentials - chapter 1
 
Python chapter 2
Python chapter 2Python chapter 2
Python chapter 2
 
python chapter 1
python chapter 1python chapter 1
python chapter 1
 
Linux Shell Scripting
Linux Shell ScriptingLinux Shell Scripting
Linux Shell Scripting
 
Perl
PerlPerl
Perl
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

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