[plt-scheme] finding a file

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Feb 19 15:24:26 EST 2005

Try split-path, eg:

  (find-files 
    (lambda (x)
      (let-values ([(base name dir?) (split-path x)])
        (equal? "myfile.scm" name))))

Robby

At Sat, 19 Feb 2005 15:20:01 -0500, Larry White wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> I want to find a file in a subdirectory.  The name of the subdirectory
> is not known in advance, but the name of the file is.  If I were
> looking for all the files with a particular extension I could use
> (find-files ...) and  (filename-extension x) like so:
> 
> (find-files 
>   (lambda (x) 
>     (equal? (filename-extension x) "scm")))
> 
> but there doesn't seem to be an equivelent method for pulling out the
> full name of the file from the path.  It seems like there should be
> something like this
> 
> (find-files 
>   (lambda (x) 
>     (equal? (filename x) "myfile.scm")))
>            
> Does it exist or is there another way?  I could use a regular
> expression to pick up everything after the last directory delimiter in
> the path x, but that seems crude.   What's the  "right" way to do
> this?
> 
> thanks for your help.



Posted on the users mailing list.