JP,
I adapted the following from a VB sample that uses API code - it's a bit long, but you should be able to get what you need from it.
[/code]
* GetDrives.Prg
* This program enumerates all drives on a Win32 system and
* displays a messagebox containing information about the
* disk volume, file system, and free disk space
*
* Usage: do GetDrives
*
DECLARE INTEGER GetLogicalDrives IN Win32API
DECLARE INTEGER GetDriveType IN Win32API STRING RootPath
DECLARE GetVolumeInformation IN win32api STRING, STRING @, INTEGER, INTEGER @, INTEGER @, INTEGER @, STRING @, INTEGER
DECLARE INTEGER GetDiskFreeSpace IN Win32API STRING DriveRoot, INTEGER @SectorsPerCluster, ;
INTEGER @BytesPerSector, INTEGER @FreeClusters, INTEGER @Clusters
IF .F.
*VB Style Declarations of above
Declare Function GetLogicalDrives Lib "kernel32" Alias "GetLogicalDrives" () As Long
Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String,
ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long,
lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String,
ByVal nFileSystemNameSize As Long) As Long
Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String,
lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long,
lpTtoalNumberOfClusters As Long) As Long
ENDIF
#DEFINE CR CHR(13)
* constants for drive types
#DEFINE DRIVE_UNKNOWN 0
#DEFINE DRIVE_NO_ROOT_DIR 1
#DEFINE DRIVE_REMOVABLE 2
#DEFINE DRIVE_FIXED 3
#DEFINE DRIVE_REMOTE 4
#DEFINE DRIVE_CDROM 5
#DEFINE DRIVE_RAMDISK 6
* Constants for file system flags
* Below are the actual decimal values. For convenience, they are expressed
* as bit numbers that should be ON for the attribute to be true
* #DEFINE FS_CASE_IS_PRESERVED 2
* #DEFINE FS_CASE_SENSITIVE 1
* #DEFINE FS_UNICODE_STORED_ON_DISK 4
* #DEFINE FS_PERSISTENT_ACLS 8
* #DEFINE FS_VOL_IS_COMPRESSED 32768
* #DEFINE FS_FILE_COMPRESSION 16
#DEFINE FS_CASE_IS_PRESERVED 1
#DEFINE FS_CASE_SENSITIVE 0
#DEFINE FS_UNICODE_STORED_ON_DISK 2
#DEFINE FS_PERSISTENT_ACLS 3
#DEFINE FS_VOL_IS_COMPRESSED 16
#DEFINE FS_FILE_COMPRESSION 4
PRIVATE m.drivestring, i
* GetLogicalDrives returns a 32-bit value containing a list of
* available drives. If the specific bit is ON, the drive letter corresponding
* to that position exists
m.drivelist = GetLogicalDrives()
* check each of the bits
FOR i = 0 TO 31
IF BITTEST(m.drivelist, i)
* if the 0th bit is ON, that means drive 'A:', the 2nd bit is 'C:", etc
m.DriveRoot = CHR(65 + i) + ":\"
* perform a GetDriveType to determine if it's a floppy, CD, etc.
m.drivetype = GetDriveType(m.DriveRoot)
DO CASE
CASE m.drivetype = DRIVE_UNKNOWN
m.drivestring = "Cannot be determined"
CASE m.drivetype = DRIVE_NO_ROOT_DIR
m.drivestring = "Root directory does not exist"
CASE m.drivetype = DRIVE_REMOVABLE
m.drivestring = "Floppy/removable drive"
CASE m.drivetype = DRIVE_FIXED
m.drivestring = "Hard drive/nonremovable drive"
CASE m.drivetype = DRIVE_REMOTE
m.drivestring = "Remote/Network drive"
CASE m.drivetype = DRIVE_CDROM
m.drivestring = "CD-ROM drive"
CASE m.drivetype = DRIVE_RAMDISK
m.drivestring = "RAM disk"
ENDCASE
* perform a GetVolumeInformation
m.RootPath = m.DriveRoot
m.volname = SPACE(255)
m.volnamelen = LEN(m.volname)
m.volumeserialnumber = 0
m.maxfilenamelen = 0
m.filesystemflags = 0
m.filesystemname = SPACE(255)
m.fsnamelen = LEN(m.filesystemname)
=GetVolumeInformation(m.RootPath, @m.volname, m.volnamelen, @m.volumeserialnumber, @m.maxfilenamelen, ;
@m.filesystemflags, @m.filesystemname, m.fsnamelen)
m.volname = LEFT(m.volname, AT(CHR(0), m.volname) - 1)
* test the file system flags, build an array of descriptions. These aren't
* mutually exclusive, so they cannot be put into a CASE structure
* how many descriptions apply to this drive
m.fsdesccount = 0
IF BITTEST(m.filesystemflags, FS_CASE_SENSITIVE)
m.fsdesccount = m.fsdesccount + 1
DIMENSION fsdesc(m.fsdesccount)
fsdesc(m.fsdesccount) = " File system preserves case of filename"
ENDIF
IF BITTEST(m.filesystemflags, FS_CASE_IS_PRESERVED)
m.fsdesccount = m.fsdesccount + 1
DIMENSION fsdesc(m.fsdesccount)
fsdesc(m.fsdesccount) = " File system supports case-sensitive filename"
ENDIF
IF BITTEST(m.filesystemflags, FS_UNICODE_STORED_ON_DISK)
m.fsdesccount = m.fsdesccount + 1
DIMENSION fsdesc(m.fsdesccount)
fsdesc(m.fsdesccount) = " File system supports Unicode in filenames"
ENDIF
IF BITTEST(m.filesystemflags, FS_PERSISTENT_ACLS)
m.fsdesccount = m.fsdesccount + 1
DIMENSION fsdesc(m.fsdesccount)
fsdesc(m.fsdesccount) = " File system preserves and enforces ACLs (NTFS only)"
ENDIF
IF BITTEST(m.filesystemflags, FS_FILE_COMPRESSION)
m.fsdesccount = m.fsdesccount + 1
DIMENSION fsdesc(m.fsdesccount)
fsdesc(m.fsdesccount) = " File system supports file-based compression"
ENDIF
IF BITTEST(m.filesystemflags, FS_VOL_IS_COMPRESSED)
m.fsdesccount = m.fsdesccount + 1
DIMENSION fsdesc(m.fsdesccount)
fsdesc(m.fsdesccount) = " Volume is compressed"
ENDIF
* file system name (FAT, NTFS, etc. is an ASCIIZ string
m.filesystemname = LEFT(m.filesystemname, AT(CHR(0), m.filesystemname) - 1)
* perform a GetDiskFreeSpace to determine free clusters, used clusters, etc
m.SectorsPerCluster = 0
m.BytesPerSector = 0
m.FreeClusters = 0
m.totalclusters = 0
m.ok = GetDiskFreeSpace(m.DriveRoot, @m.SectorsPerCluster, @m.BytesPerSector, ;
@m.FreeClusters, @m.totalclusters)
m.fsflagstring = ""
FOR j = 1 TO m.fsdesccount
m.fsflagstring = m.fsflagstring + fsdesc(j) + CR
NEXT
=MESSAGEBOX("Drive " + m.DriveRoot + CR + ;
"Drive Type: " + LTRIM(STR(m.drivetype)) + " " + m.drivestring + CR + ;
"Volume name: " + m.volname + CR + ;
"Volume serial number: " + transform(m.volumeserialnumber, "@0x ") + CR + ;
"Maximum file name length: " + LTRIM(STR(m.maxfilenamelen)) + CR + ;
"File system flags: " + CR + ;
m.fsflagstring + ;
"File system name: " + m.filesystemname + CR + CR + ;
"Sectors/cluster: " + STR(m.SectorsPerCluster) + CR + ;
"Bytes/Sector: " + STR(m.BytesPerSector) + CR + ;
"Free clusters: " + STR(m.FreeClusters) + CR + ;
"Total clusters: " + STR(m.totalclusters), ;
0 + 64 + 0, ;
"Disk volume information")
ENDIF
NEXT
* EOP: GetDrives.Prg
[/code]
Rick