The cl-diskspace Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-diskspace Reference Manual

This is the cl-diskspace Reference Manual, version 0.3.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 03:38:34 2022 GMT+0.

Table of Contents


1 Introduction

cl-diskspace

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.

License

Copyright (c) 2015 Muyinliu Xing Released under the ISC License.

Compatibility

| 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.

Install and load with QuickLisp

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)

Usage

List all disks

(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

Get all disk space information

(diskspace:list-all-disk-info)

Will get something like this:

((:DISK "/" :TOTAL 127175917568 :FREE 16509661184 :AVAILABLE
16247517184 :USE-PERCENT 87))

Get all disk space information in human-readable

(diskspace:list-all-disk-info t)

Will get something like this:

((:DISK "/" :TOTAL "118.44G" :FREE "15.38G" :AVAILABLE
"15.13G" :USE-PERCENT 87))

Get disk space information

(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

Get disk space information in human-readable

(diskspace:disk-space "/" t)

Will get something like this:

"118.44G"
"15.38G"
"15.13G"

Get disk total space

(diskspace:disk-total-space "/")

Will get something like this:

127175917568

Get disk total space in human-readable

(diskspace:disk-total-space "/" t)

Will get something like this:

"118.4G"

Get disk free space

(diskspace:disk-free-space "/")

Will get something like this:

16509661184

Get disk free space in human-readable

(diskspace:disk-free-space "/" t)

Will get something like this:

"15.38G"

Get disk available space

(diskspace:disk-available-space "/")

Will get something like this:

16247517184

Get disk available space in human-readable

(diskspace:disk-available-space "/" t)

Will get something like this:

"15.13G"

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-diskspace

List disks, get disk total/free/usable space information.

Author

Muyinliu Xing <muyinliu@gmail.com>

License

ISC

Version

0.3.1

Defsystem Dependency

cffi-grovel (system).

Dependencies
  • cffi (system).
  • cl-ppcre (system).
  • uiop (system).
Source

cl-diskspace.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


Next: , Previous: , Up: Modules   [Contents][Index]

3.1 cl-diskspace/src

Source

cl-diskspace.asd.

Parent Component

cl-diskspace (system).

Child Components

Previous: , Up: Modules   [Contents][Index]

3.2 cl-diskspace/src/unix

Dependency

utils.lisp (file).

Source

cl-diskspace.asd.

Parent Component

src (module).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.1 cl-diskspace/cl-diskspace.asd

Source

cl-diskspace.asd.

Parent Component

cl-diskspace (system).

ASDF Systems

cl-diskspace.


4.1.2 cl-diskspace/src/packages.lisp

Source

cl-diskspace.asd.

Parent Component

src (module).

Packages

cl-diskspace.


4.1.3 cl-diskspace/src/utils.lisp

Dependency

packages.lisp (file).

Source

cl-diskspace.asd.

Parent Component

src (module).

Public Interface

size-in-human-readable (function).


4.1.4 cl-diskspace/src/unix/grovel-statvfs.lisp

Source

cl-diskspace.asd.

Parent Component

unix (module).


4.1.5 cl-diskspace/src/unix/cl-diskspace-list-all-disks-with-df.lisp

Dependency

grovel-statvfs.lisp (file).

Source

cl-diskspace.asd.

Parent Component

unix (module).

Public Interface

list-all-disks (function).


4.1.6 cl-diskspace/src/unix/cl-diskspace-statvfs.lisp

Dependency

cl-diskspace-list-all-disks-with-df.lisp (file).

Source

cl-diskspace.asd.

Parent Component

unix (module).

Public Interface
Internals

4.1.7 cl-diskspace/src/common.lisp

Dependency

unix (module).

Source

cl-diskspace.asd.

Parent Component

src (module).

Public Interface

list-all-disk-info (function).


5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 cl-diskspace

Source

packages.lisp.

Nicknames
  • ds
  • diskspace
Use List
  • cffi.
  • cffi-grovel.
  • common-lisp.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


6.1.1 Ordinary functions

Function: disk-available-space (path &optional human-readable-p)

Disk available space.

Package

cl-diskspace.

Source

cl-diskspace-statvfs.lisp.

Function: disk-free-space (path &optional human-readable-p)

Disk free space.

Package

cl-diskspace.

Source

cl-diskspace-statvfs.lisp.

Function: disk-space (path &optional human-readable-p)

Disk space information include total/free/available space.

Package

cl-diskspace.

Source

cl-diskspace-statvfs.lisp.

Function: disk-total-space (path &optional human-readable-p)

Disk total space.

Package

cl-diskspace.

Source

cl-diskspace-statvfs.lisp.

Function: list-all-disk-info (&optional human-readable-p)

List disk information. example result:
((:DISK "/" :TOTAL 19993329664 :FREE 6154420224 :AVAILABLE 6154420224 :USE-PERCENT 69)
(:DISK "/mnt" :TOTAL 21136445440 :FREE 2048335872 :AVAILABLE 974667776 :USE-PERCENT 95))

((:DISK "/" :TOTAL "18.62 GB" :FREE "5.73 GB" :AVAILABLE "5.73 GB" :USE-PERCENT 69)
(:DISK "/mnt" :TOTAL "19.68 GB" :FREE "1.91 GB" :AVAILABLE "929.52 MB" :USE-PERCENT 95))

Package

cl-diskspace.

Source

common.lisp.

Function: list-all-disks ()

List all physical disk use command line tool df. note: size in KB.

Package

cl-diskspace.

Source

cl-diskspace-list-all-disks-with-df.lisp.

Function: size-in-human-readable (number)
Package

cl-diskspace.

Source

utils.lisp.


6.2 Internals


Previous: , Up: Internals   [Contents][Index]

6.2.1 Ordinary functions

Function: %statvfs (path buf)
Package

cl-diskspace.

Source

cl-diskspace-statvfs.lisp.

Function: statvfs (path)
Package

cl-diskspace.

Source

cl-diskspace-statvfs.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   F   G   M   P   S   U  
Index Entry  Section

C
cl-diskspace: The cl-diskspace system
cl-diskspace: The cl-diskspace package
cl-diskspace-list-all-disks-with-df.lisp: The cl-diskspace/src/unix/cl-diskspace-list-all-disks-with-df․lisp file
cl-diskspace-statvfs.lisp: The cl-diskspace/src/unix/cl-diskspace-statvfs․lisp file
cl-diskspace.asd: The cl-diskspace/cl-diskspace․asd file
common.lisp: The cl-diskspace/src/common․lisp file

F
File, cl-diskspace-list-all-disks-with-df.lisp: The cl-diskspace/src/unix/cl-diskspace-list-all-disks-with-df․lisp file
File, cl-diskspace-statvfs.lisp: The cl-diskspace/src/unix/cl-diskspace-statvfs․lisp file
File, cl-diskspace.asd: The cl-diskspace/cl-diskspace․asd file
File, common.lisp: The cl-diskspace/src/common․lisp file
File, grovel-statvfs.lisp: The cl-diskspace/src/unix/grovel-statvfs․lisp file
File, packages.lisp: The cl-diskspace/src/packages․lisp file
File, utils.lisp: The cl-diskspace/src/utils․lisp file

G
grovel-statvfs.lisp: The cl-diskspace/src/unix/grovel-statvfs․lisp file

M
Module, src: The cl-diskspace/src module
Module, unix: The cl-diskspace/src/unix module

P
Package, cl-diskspace: The cl-diskspace package
packages.lisp: The cl-diskspace/src/packages․lisp file

S
src: The cl-diskspace/src module
System, cl-diskspace: The cl-diskspace system

U
unix: The cl-diskspace/src/unix module
utils.lisp: The cl-diskspace/src/utils․lisp file

Jump to:   C   F   G   M   P   S   U