Directory? versus File?
Posted: Sat Aug 14, 2004 6:15 pm
Hello Lutz,
Someting funny, perhaps behaviour?
but maybe you can explain it... see below ->
;;; show all dirs in current dir
> (dolist (d (directory ".")) (if (directory? d) (println d)))
.
..
dir1
dir2
dir3
dir4
nil
;; show all files in current dir
> (dolist (d (directory ".")) (if (file? d) (println d)))
.
..
one
two
three
four
..
..
"lastfile"
;; now show all dirs 1 dir back (there are 10 dirs there!)
> (dolist (d (directory "../")) (if (directory? d) (println d)))
.
..
nil
;; or
> (dolist (d (directory "./../")) (if (directory? d) (println d)))
.
..
nil
;;; Now we do the same but with file?
> (dolist (d (directory "../")) (if (file? d) (println d)))
.
..
test1
test2
nil
I notice that 'directory? is linked to the inodes on the filesystem
so its not a problem in 'directory? because a normal
(directory? "/") returns -> true.... so thats oke...
;; here i try to display all dirs in the "root"
> (dolist (d (directory "/")) (if (directory? d) (println d)))
.
..
nil
;; now with file?
> (dolist (d (directory "/")) (if (file? d) (println d)))
.
..
test
nil
But im lost actualy... Because the last 'Directory? shown below
does not exist ;-) still it returns true.. So this implies
that 'directory does not look for the inode index..Or does it?
The "/" is not the "root" but 1 directory back...> (file? "/")
true
> (directory? "/")
true
> (directory? "../../")
true
> (directory? "../../../../../")
true
> (directory? "../../../../../../../../../")
true
Testing the above with 'dolist it could be a list behaviour??? ->
The "." is the current directory
The "./" is also the current directory
The "../../" is 2 directory's back, understoud by File? but not by Directory?
The "/." could be the root? but its not
Please help me out ;-)
Regards, Norman
Someting funny, perhaps behaviour?
but maybe you can explain it... see below ->
;;; show all dirs in current dir
> (dolist (d (directory ".")) (if (directory? d) (println d)))
.
..
dir1
dir2
dir3
dir4
nil
;; show all files in current dir
> (dolist (d (directory ".")) (if (file? d) (println d)))
.
..
one
two
three
four
..
..
"lastfile"
;; now show all dirs 1 dir back (there are 10 dirs there!)
> (dolist (d (directory "../")) (if (directory? d) (println d)))
.
..
nil
;; or
> (dolist (d (directory "./../")) (if (directory? d) (println d)))
.
..
nil
;;; Now we do the same but with file?
> (dolist (d (directory "../")) (if (file? d) (println d)))
.
..
test1
test2
nil
I notice that 'directory? is linked to the inodes on the filesystem
so its not a problem in 'directory? because a normal
(directory? "/") returns -> true.... so thats oke...
;; here i try to display all dirs in the "root"
> (dolist (d (directory "/")) (if (directory? d) (println d)))
.
..
nil
;; now with file?
> (dolist (d (directory "/")) (if (file? d) (println d)))
.
..
test
nil
But im lost actualy... Because the last 'Directory? shown below
does not exist ;-) still it returns true.. So this implies
that 'directory does not look for the inode index..Or does it?
The "/" is not the "root" but 1 directory back...> (file? "/")
true
> (directory? "/")
true
> (directory? "../../")
true
> (directory? "../../../../../")
true
> (directory? "../../../../../../../../../")
true
Testing the above with 'dolist it could be a list behaviour??? ->
The "." is the current directory
The "./" is also the current directory
The "../../" is 2 directory's back, understoud by File? but not by Directory?
The "/." could be the root? but its not
Please help me out ;-)
Regards, Norman