Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Matlab Command to get free hd disk space?

3 views
Skip to first unread message

RobT

unread,
May 9, 2004, 11:15:36 AM5/9/04
to
I'm doing some avi stuff which writes quite a lot to the hard disk,
and want to prevent the user starting a script if there is not enough
free physical disk space.

Does anyone know how to get the amount of free physical disk space
(on a windows XP machine...) via the matlab command line?

I've found and experimented with dumpmemmex command and so on, but
really just want the total free disk space rather than that available
in virtual memory.

thanks in advance.

Herbert Ramoser

unread,
May 10, 2004, 2:54:49 AM5/10/04
to

One possibility is to execute

[c,d]=dos('dir');

and parse the last line of d. Maybe somebody comes up with a better idea.

-Herbert

RobT

unread,
May 10, 2004, 6:42:45 AM5/10/04
to
Thanks H, got it working with the code,

[c,d] = dos('dir');
[c,e] = size(d);
f = strrep(d((e-27):(e-11)),',','');
Gb_free = str2num(f)/(1024*1024*1024);
clear c d e f

its not the prettiest piece of code, but it works :-).

Anders Björk

unread,
May 10, 2004, 6:48:23 AM5/10/04
to
Doing a search on google groups gives this link
http://groups.google.se/groups?q=space+group:alt.msdos.batch.*&start=10&hl=sv&lr=&ie=UTF-8&oe=UTF-8&group=alt.msdos.batch.*&selm=c6193t%246pd3n%241%40ID-170595.news.uni-berlin.de&rnum=14

Adapted in matlab, this works only on xp, the drive must be NTFS-drive
[status output]=dos('fsutil volume diskfree g:')

BR
Anders

"Herbert Ramoser" <herbert_D...@gmx.net> skrev i meddelandet
news:2g8nb0F...@uni-berlin.de...

Igor

unread,
May 23, 2013, 3:20:19 PM5/23/13
to
RobT <robert...@imperial.ac.uk> wrote in message <eedcb...@webx.raydaftYaTP>...
> Does anyone know how to get the amount of free physical disk space
> (on a windows XP machine...) via the matlab command line?


This might be necroposting, but this thread is still on google's top.

So, I anyone is still looking for a tool to return free space on HDD - try this:

http://www.mathworks.com/matlabcentral/fileexchange/41904-disk-usage
0 new messages