Two hard drives and files related tips (C #)

xiaoxiao2021-03-06  125

Take the drive letter of the hard disk partition, use the API function: getDriveType

[DLLIMPORT ("kernel32.dll", entrypoint = "getDriveType")]

Public Static Extern Int GetDriveType (String NDrive);

Call: String [] DIRS = Environment.getLogicalDrives (); // Get all drives forward (String Dir in DIRS) {? F (getDriveType (DIR) == 3) // Is the hard disk? {??? // Add it to the list? Subdirs) {?? IF (Subdir.attributes.tostring (). Indexof ("Hidden") <0 || Subdir.attributes.tostring (). Indexof ("System") <0)? {?? ...? }

转载请注明原文地址:https://www.9cbs.com/read-98893.html

New Post(0)