disk serial numbaer
Posted: Thursday 5th October 2017 12:12am
Hello,
How to read the usb stick volume serial number?
Thank
Sony
How to read the usb stick volume serial number?
Thank
Sony
Code: Select all
Public Sub Main()
'this sub uses the list of links in: /dev/disk/by-id/
'...which includes the device identity and serial number
Dim strDisk As String
Dim strLink As String
Dim strName As String
Dim strSerial As String
For Each strDisk In Dir("/dev/disk/by-id", "usb-*", gb.Link)
strLink = Stat("/dev/disk/by-id/" & strDisk).Link
strLink = "/dev/" & Right(strLink, - RInStr(strLink, "/"))
If Len(strLink) = 8
strDisk = Mid(strDisk, InStr(strDisk, "_") + 1)
strDisk = Mid(strDisk, 1, InStr(strDisk, "-") - 1)
strName = Replace(Left(strDisk, RInStr(strDisk, "_")), "_", " ")
strSerial = Mid(strDisk, RInStr(strDisk, "_") + 1, InStr(strDisk, "-") - 1)
Print strName & " serNo: " & strSerial
Endif
Next
End