Drive Information?

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

Posts: 2
Joined: Mon Aug 10, 2009 3:16 am

Drive Information?

Postby wolfman775 » Mon Aug 10, 2009 3:23 am

Hi, Im new here (But not to FreeBASIC), and I was wondering if anybody knew how to get the label and Free/total disk space from a given drive? and possibly the model name?

Thanks in advance.

User avatar
Posts: 12
Joined: Sun Oct 03, 2004 7:53 am
Location: North Carolina

Use the "shell" command.

Postby UWLabs » Mon Aug 10, 2009 8:54 am

Just use shell to access the
Then use simple OS command line commands and save the output; just redirect it to a text file.

For example, to get the name of the harddrive, use the Volume command and pipe it to a text file (then read the text file later).

Code: Select all

SHELL "vol > hdd_labl.txt"

That will shell out to the command prompt run the "vol" command and send the results to a newly created file named hdd_labl.txt which you can open and read later.

For disk size the directory command (dir) has a bunch of options.
the last two lines always output, are the the number of files in the current directory (folder) and the free disk space.

The output will look something like this:

Code: Select all

 Volume in drive C has no label.
 Volume Serial Number is 686B-F0F2

 Directory of C:\

04/13/2009  07:27 AM    <DIR>          7b6bee7553a7b2f5ce2dda1d
01/30/2007  12:24 PM    <DIR>          8c3127ede316849a3e19bd723f
12/08/2006  05:16 PM                 0 CONFIG.SYS
04/15/2009  07:40 AM    <DIR>          Documents and Settings
05/29/2009  09:53 AM    <DIR>          Program Files
04/27/2009  07:51 AM    <DIR>          QBasic
03/11/2009  10:53 AM    <DIR>          QuickBas
08/06/2009  04:30 PM    <DIR>          Temp
08/10/2009  07:48 AM    <DIR>          WINDOWS
               1 File(s)      1,892,240 bytes
               8 Dir(s)  35,276,324,864 bytes free
              29 Dir(s)  35,276,324,864 bytes free

Now good practice is to use specific file extensions for easier recognition by others - so if you forget to 'cleanup' they might know what the file is.
TXT (text)
LST (list)
TMP (temp)
$$$ (string-temp)
$ (string temp)
QB (qbasic)

Another best practice would be to just "kill" the file after you are done with it, using the BASIC KILL command.

Hope this helps.

Posts: 2
Joined: Mon Aug 10, 2009 3:16 am

Postby wolfman775 » Tue Aug 11, 2009 10:02 am

Thanks verry much, i didnt know about the vol command.

Posts: 2
Joined: Fri Sep 01, 2017 1:02 am

Drive Information

Postby cicadvicky » Fri Sep 08, 2017 12:07 pm

Hello to everybody.
I have a popcorn A110 with and internal drive and with a USB Drive what should i do sho the Movieflow can compine the output of both drives ???

Thanks in advance

Return to “Freebasic Questions & Answers”

Who is online

Users browsing this forum: No registered users and 1 guest