Perform a research a la Unix 'find'

Hello, I would like to recode in Haskell a piece of bash program that uses find. The advantage of find is that it is quite easy to use and fast. Is there a package that let us access to find-like functionnalities, with similar performances? Or at least some C functions that could be used through the FFI? (I would like to avoid to recur through directories and match files myself, I tried it and the search lasts for ages).

I've used the FileManip package for this. It works fine for my
purposes. I have no idea what the performance is, though, beyond 'good
enough not to care at the moment'.
Erik
On Sun, Aug 22, 2010 at 17:32, Yves Parès
Hello,
I would like to recode in Haskell a piece of bash program that uses find. The advantage of find is that it is quite easy to use and fast. Is there a package that let us access to find-like functionnalities, with similar performances? Or at least some C functions that could be used through the FFI? (I would like to avoid to recur through directories and match files myself, I tried it and the search lasts for ages).
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thanks, I will take a look at it.
2010/8/22 Erik Hesselink
I've used the FileManip package for this. It works fine for my purposes. I have no idea what the performance is, though, beyond 'good enough not to care at the moment'.
Erik
On Sun, Aug 22, 2010 at 17:32, Yves Parès
wrote: Hello,
I would like to recode in Haskell a piece of bash program that uses find. The advantage of find is that it is quite easy to use and fast. Is there a package that let us access to find-like functionnalities, with similar performances? Or at least some C functions that could be used through the FFI? (I would like to avoid to recur through directories and match files myself, I tried it and the search lasts for ages).
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 22/08/10 16:32, Yves Parès wrote:
Hello,
I would like to recode in Haskell a piece of bash program that uses find. The advantage of find is that it is quite easy to use and fast. Is there a package that let us access to find-like functionnalities, with similar performances? Or at least some C functions that could be used through the FFI? (I would like to avoid to recur through directories and match files myself, I tried it and the search lasts for ages).
Take a look at HSH on hackage. I've used that many times to inject some sanity into stuff that I used to do with bash. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe

Thanks for the HSH link, Magnus.
Concerning FileManip, it seems that I can't perform easily a
case-insensitive search (for instance with find, you just use -iname instead
of -name). Am I wrong?
2010/8/22 Magnus Therning
On 22/08/10 16:32, Yves Parès wrote:
Hello,
I would like to recode in Haskell a piece of bash program that uses find. The advantage of find is that it is quite easy to use and fast. Is there a package that let us access to find-like functionnalities, with similar performances? Or at least some C functions that could be used through the FFI? (I would like to avoid to recur through directories and match files myself, I tried it and the search lasts for ages).
Take a look at HSH on hackage. I've used that many times to inject some sanity into stuff that I used to do with bash.
/M
-- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I looked at both, and I have encoding issues with both.
My locale is fr_FR.utf8
For instance, with HSH:
I have a 'bar' directory, containing a file 'fooé'
run $ "find bar" :: IO [String]
returns me : ["bar", "bar/foo*\233*"]
and run $ "find bar -name fooé"
returns []
When I provoke an error by running:
run $ "find fooé"
it says :
find: "foo*\351*": No file or directory
So it is not the same encoding!
2010/8/22 Yves Parès
Thanks for the HSH link, Magnus.
Concerning FileManip, it seems that I can't perform easily a case-insensitive search (for instance with find, you just use -iname instead of -name). Am I wrong?
2010/8/22 Magnus Therning
On 22/08/10 16:32, Yves Parès wrote:
Hello,
I would like to recode in Haskell a piece of bash program that uses find. The advantage of find is that it is quite easy to use and fast. Is there a package that let us access to find-like functionnalities, with similar performances? Or at least some C functions that could be used through the FFI? (I would like to avoid to recur through directories and match files myself, I tried it and the search lasts for ages).
Take a look at HSH on hackage. I've used that many times to inject some sanity into stuff that I used to do with bash.
/M
-- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 22/08/10 17:56, Yves Parès wrote:
I looked at both, and I have encoding issues with both.
My locale is fr_FR.utf8 For instance, with HSH: I have a 'bar' directory, containing a file 'fooé'
run $ "find bar" :: IO [String] returns me : ["bar", "bar/foo*\233*"]
and run $ "find bar -name fooé" returns []
When I provoke an error by running: run $ "find fooé" it says : find: "foo*\351*": No file or directory
So it is not the same encoding!
Yes, that's no good. I should put in a caveat, I have only used HSH in "privileged" locales. I urge you to raise it with the maintainer of HSH since it's a serious shortcoming. /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
participants (3)
-
Erik Hesselink
-
Magnus Therning
-
Yves Parès