[plt-scheme] finding a file

From: David Herman (dherman at ccs.neu.edu)
Date: Sat Feb 19 21:11:57 EST 2005

> (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?

Try my PLaneT library, io.plt:

     http://planet.plt-scheme.org:80/300/#io.plt1.4

The procedure you want is called basename (named after the Unix 
program):

     (require (planet "file.ss" ("dherman" "io.plt" 1)))

     (find-files
       (lambda (f)
         (string=? (path->string (basename f))
                   "myfile.scm")))

Dave



Posted on the users mailing list.