cl-diskspace is a Common Lisp feature to list disks with command line tool df
(Linux/Mac) or GetLogicalDrives
(Windows), and get disk space information using statvfs
(Unix/Linux/Mac) or GetDiskFreeSpace
(Windows), supports Unix/Linux/Mac/Windows.
Copyright (c) 2015 Muyinliu Xing Released under the ISC License.
Common Lisp | Linux | Mac | Unix | Windows |
---|---|---|---|---|
SBCL | Yes | Yes | Yes |
Note: I don't have Unix system so haven't test on Unix yet.
Note: Have test in Windows XP/Windows 7/Windows 8.1/Windows 10
Note: Welcome to reply test results in other Common Lisp implements.
In shell:
git clone https://github.com/muyinliu/cl-diskspace.git
cp -r cl-diskspace ~/quicklisp/local-projects/
In Common Lisp:
(ql:quickload 'cl-diskspace)
(diskspace:list-all-disks)
Will get something like this:
("/" "/Volumes/Seagate1T")
Note: result in Mac
(diskspace:list-all-disks)
Will get something like this:
("C:\\" "D:\\")
Note: result in Windows
(diskspace:list-all-disk-info)
Will get something like this:
((:DISK "/" :TOTAL 127175917568 :FREE 16509661184 :AVAILABLE
16247517184 :USE-PERCENT 87))
(diskspace:list-all-disk-info t)
Will get something like this:
((:DISK "/" :TOTAL "118.44G" :FREE "15.38G" :AVAILABLE
"15.13G" :USE-PERCENT 87))
(diskspace:disk-space "/")
Will get something like this:
127175917568
16509661184
16247517184
Note: the total space is 118.44G, free space is 15.38G and available space is 15.13G
(diskspace:disk-space "/" t)
Will get something like this:
"118.44G"
"15.38G"
"15.13G"
(diskspace:disk-total-space "/")
Will get something like this:
127175917568
(diskspace:disk-total-space "/" t)
Will get something like this:
"118.4G"
(diskspace:disk-free-space "/")
Will get something like this:
16509661184
(diskspace:disk-free-space "/" t)
Will get something like this:
"15.38G"
(diskspace:disk-available-space "/")
Will get something like this:
16247517184
(diskspace:disk-available-space "/" t)
Will get something like this:
"15.13G"