dwtotal.blogg.se

Root directory of c drive
Root directory of c drive










root directory of c drive

Here are some of the most useful DirectoryInfo members for when we work with a computer drive’s RootDirectory property (Microsoft Docs, n.d. And the DirectoryInfo methods make it possible to copy, move, enumerate, rename, create, and delete directories. With those properties we fetch directory information, like access times, names, and paths. That DirectoryInfo object has several properties and methods for directory-related operations. What a drive’s RootDirectory property does is return a DirectoryInfo object for the computer drive’s root folder (Stephens, 2014 Microsoft Docs, n.d. # Properties and methods of a drive’s root directory in C# The console output of the above code snippet is: Name: C:\ Then we look up that drive’s root directory information through its RootDirectory property, like its name and the creation and last access time. We first make an instance of the C:\ drive with the DriveInfo() constructor. WriteLine ( "Last access time: " + cDrive. Here’s a quick example of how we can access a drive’s root directory through RootDirectory:ĭriveInfo cDrive = new DriveInfo ( "C" ) // Look up some root directory informationĬonsole.

root directory of c drive

With that property we can fetch all kinds of folder information from a particular drive. An interesting property is RootDirectory, which returns a DirectoryInfo object that represents that drive’s root directory (Stephens, 2014). That makes it possible to check the drive’s free space or get or set the drive’s volume label. With a DriveInfo object we can access various properties to fetch drive information. To get a DriveInfo object we either call the DriveInfo() constructor or the DriveInfo.GetDrives() method. A DriveInfo instance represents a single computer drive, and that object has several properties for all kinds of drive information. We get drive information in C# with the DriveInfo class from the System.IO namespace (Asad & Ali, 2017 Stephens, 2014). # Fetch drive information and root directories in C#

  • Example: search computer folders with a certain name.
  • Example: get all directories from a particular computer drive.
  • root directory of c drive root directory of c drive

  • Properties and methods of a drive’s root directory in C#.
  • Fetch drive information and root directories in C#.











  • Root directory of c drive