Determine the File System Type

With the advent of the FAT32 file system, you might want to use VB to determine the type of file system being used for a particular drive. This example is set for the C drive; change the variable sDrive to test other drives. Run this routine; the variable sResult contains the file system name string:

 Private 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 LongPublic Function WhichFileSystem(ByVal Drive _	As String) As String	Dim sVolBuf As String * 255	Dim sSysName As String * 255	Dim lSerialNum As Long	Dim lSysFlags As Long	Dim lComponentLength As Long	Dim lRes As Long	lRes = GetVolumeInformation(Drive, sVolBuf, _		255, lSerialNum, lComponentLength, _		lSysFlags, sSysName, 255)	If lRes Then		WhichFileSystem = Left$(sSysName, _			InStr(sSysName, Chr$(0)) - 1)	Else		WhichFileSystem = ""	End IfEnd Function
Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: