Code covered by the BSD License  

Highlights from
Disk usage

4.0
4.0 | 3 ratings Rate this file 13 Downloads (last 30 days) File Size: 1.99 KB File ID: #41904 Version: 1.1
image thumbnail

Disk usage

by

Igor (view profile)

 

23 May 2013 (Updated )

Queries free and total space of a volume

| Watch this File

File Information
Description

%DISK_FREE return free disk space for specified folder in bytes (double)
% INPUT ARGUMENTS:
% * some_path - string, existing file or folder path. Should be global.
%
% USAGE:
% * disk_free('C:\temp'); % regular usage
% * disk_free('C:\temp\1.txt'); % path points to a file
% * disk_free('\\?\C:\temp'); % UNCW path
% * disk_free('\\\\C:\temp'); % UNCW path with with java-style prefix
% * disk_free('\\IMP\Ctemp'); % samba share folder
% *
%
% INVALID USAGE:
% * disk_free('\\IMP'); % samba share root. Results in error.
%
% * disk_free('C'); % Use 'C:' instead. Results in error.
%
% * disk_free('disk_free') % Matlab function. Results in [0 0 0]
% % or some other result, if corresponding
% % local file was found.
% % i.e. don't use local paths!
%
% NOTE:
% Would result in an error for an empty DVD-rom drive (disk not inserted).
% And similar cases.

Acknowledgements

Disk Usage and Diskfree inspired this file.

Required Products MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Other requirements Windows, java
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
26 Sep 2013 David Freedman

David Freedman (view profile)

 
27 May 2013 Igor

Igor (view profile)

Thanks for your review, Jan!
I've tired to fix those defects you've described. Just uploaded it. Hope it would be updated shortly.

Comment only
26 May 2013 Jan Simon

Jan Simon (view profile)

Just a note: "\\?\C:\" is not an UNC path, but this is the prefix allows to use Windows API functions with long names (uo to about 32767). "\\Server\share\" is an UNC path and you can use it to access samba shares, but not only them.

"path" is an important Matlab function. Shadowing it by a local variable with the same name can lead to serious troubles e.g. during debugging.

Beside these small details, this function is well documented, useful and usable. I'd add the name of the author and a version date to the help section.

24 May 2013 Shahab

Shahab (view profile)

 
23 May 2013 Igor

Igor (view profile)

This submission is based on Jan Simon's suggestion:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/284781#781392

Comment only
Updates
28 May 2013 1.1

% 27/02/12:
% * fixed some terminology
% * removed 'path' function shadowing
% * added note about local paths

Contact us