freenode/#lisp - IRC Chatlog
Search
13:55:01
jackdaniel
there is also external-program which is good in this sense that it doesn't try to do more than provide a compatibiliy layer between different implementations
0:18:53
White_Flame
none comes to mind, but with multiple drives/partitions, the notion needs more specificity
0:23:05
Nilby
I have a thing, but I can't recommend it: (nos:filesystem-info-bytes-free (nos:get-filesystem-info "/"))
0:32:07
Nilby
Typical Lisp reasones: no docs, no tests, 1 user, poorly maintained, capricious developer, etc.
1:15:34
pjb
saturn2: in posix, you would use /bin/df with the path of a item stored on the file system.
1:16:03
pjb
saturn2: but note that file systems are unrelated to disks: a disk may contain several file systems, and a file system may be stored on 0, 1 or more disks.
1:16:46
pjb
saturn2: if you have the access rights, you could try to read the parttion table on the raw disk device, and interpret it to see if there's some free disk space between partitions?
1:35:27
pjb
saturn2: by the time you get the information you believe you need, it may be totally wrong!
1:35:46
pjb
saturn2: another user may have allocated all the remaining space, or another process may have deleted files!
1:36:28
pjb
saturn2: so the only way to do it, and this is the big lesson of unix, and why it has been so successful compared to other OSes old an new, is that you don't want to use such query, but instead you want to do what you want to do, and wait for an error to occur if it's not possible.
1:39:06
pjb
saturn2: you can pre-allocate a file: (handler-case (with-open-file (out "DATA:FILE.BIN" :element-type '(unsigned-byte 8) :direction :output :if-does-not-exist :create :if-exists :error) (loop with buffer = (make-array (* 1024 1024) :element-type '(unsigned-byte 8) :initial-element 42) repeat 1024 do (write-sequence buffer out))) (:no-error () t) (error () nil))