Two hard drives and files related tips (C #)

zhaozj2021-02-16  65

Only some illustrative code takes a disk partition of the hard disk partition of the system, with API functions: 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-14666.html

New Post(0)