Steven email: sjh@svana.org
web: https://svana.org/sjh Other online diaries:
Aaron Broughton, Links:
Linux Weekly News, Canberra Weather: forecast, radar.
Categories:
|
Mon, 28 Mar 2005
Faster directory reading - 20:13
Mikal asks if there is a faster way to read a directory than using open and ls and stuff. This reminds me of a buttload entry a bit
<Schwern> Are we using perl to generate a shell script? Anyway with perl and TMTOWTDI the answer is yes you can do this faster. Michael, the simplest way is simply using opendir and readdir, if you look at the documentation in "perldoc -f readdir" you can probably see an example. Using native perl is always going to be faster than launching a separate shell (which you probably realise, explaining why you wondered if there is some faster way). Of course looking at the things you have been asking today I wonder if the perl module File::Find may help you out with doing some of the stuff you need. |