factor/library/io/files.factor

15 lines
503 B
Factor
Raw Normal View History

! Copyright (C) 2004, 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: io
USING: kernel lists sequences strings ;
! Words for accessing filesystem meta-data.
2004-11-25 21:51:47 -05:00
2005-06-19 18:31:02 -04:00
: path+ ( path path -- path ) "/" swap append3 ;
: exists? ( file -- ? ) stat >boolean ;
2005-03-19 00:30:49 -05:00
: directory? ( file -- ? ) stat car ;
: directory ( dir -- list ) (directory) [ string> ] sort ;
: file-length ( file -- length ) stat third ;
: file-extension ( filename -- extension )
"." split cdr dup [ peek ] when ;