Hi Stephen,

Yep, I saw file-exists?, thanks. Like I said, I don't want to check the
disk twice (once when getting the list of paths with (in-directory), then
again with file-exists?). I don't care if the file actually exists on disk,
I care if this path is describing a file or a directory. I'm hoping to be
able to do something like, e.g., use (fold-files) or (find-files)
to process just files or just directories.

On Thursday, July 21, 2016, Stephen De Gabrielle <spdegabrie...@gmail.com>
wrote:

>
> http://docs.racket-lang.org/reference/Filesystem.html#%28def._%28%28quote._~23~25kernel%29._file-exists~3f%29%29
>
> in http://docs.racket-lang.org/reference/Filesystem.html
>
>
>
> (file-exists?
> <http://docs.racket-lang.org/reference/Filesystem.html#%28def._%28%28quote._~23~25kernel%29._file-exists~3f%29%29>
>  path) → boolean?
> <http://docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29>
> (link-exists?
> <http://docs.racket-lang.org/reference/Filesystem.html#%28def._%28%28quote._~23~25kernel%29._link-exists~3f%29%29>
>  path) → boolean?
> <http://docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29>
>
> (directory-exists?
> <http://docs.racket-lang.org/reference/Filesystem.html#%28def._%28%28quote._~23~25kernel%29._directory-exists~3f%29%29>
>  path) → boolean?
> <http://docs.racket-lang.org/reference/booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29>
>
>   path : path-string?
> <http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._path-string~3f%29%29>
>
> Returns #t if path refers to a directory, #f otherwise.
>
>
> On Thu, Jul 21, 2016 at 7:44 PM, David Storrs <david.sto...@gmail.com
> <javascript:_e(%7B%7D,'cvml','david.sto...@gmail.com');>> wrote:
>
>> Silly question: given a <#path>, how do I tell if it's to a file,
>> directory, link, etc?  I'd like to know this in general, although the
>> proximate issue is that I would like to use (in-directory) to process
>> all the files in a directory, but I need a way to ignore everything
>> that isn't a file.
>>
>> I saw 'file-exists?' but I don't want to check the disk twice, I just
>> want to know what type it is.  That information should have been
>> available when the path was constructed.
>>
>>
>> In a related question, is there a way to introspect a struct to find
>> out what its fields are?
>>
>>
>> Dave
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com
>> <javascript:_e(%7B%7D,'cvml','racket-users%2bunsubscr...@googlegroups.com');>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to