Determine the File System Type

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
See also  How to Avoid Money Transfer Scams  

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist