1. Traversing directory and checking attributes

Hi,

I'm new to the Euphoria language. I've written a routine that is too
slow in Perl and hope Euphoria is faster. I guess this is partly basic
stuff.

I need to traverse a directory tree, say C:\, and get the filenames,
directory names.

Then I need to get the status of the file attributes archive/read/ etc

Does anybody have such code already, so I can see whether Euphoria
might be faster?

Thanks,

Marcus

new topic     » topic index » view message » categorize

2. Re: Traversing directory and checking attributes

Hello Marcus,

Welcome to Euphoria!

The walk_dir function was one of the reasons Euphoria caught my eye when I
was looking for a language that would run on both Windows and Linux.  I've
never done any benchmarking myself but up against Perl I'd have my money on
Euphoria any day of the week!

The Euphoria User Contribution archive:

  http://www.rapideuphoria.com/archive.htm

will contain many examples of how to use walk_dir but I'll plug mine first
:-]  It's a little utility called "id3adder" that recurses down one of more
directory structures looking for MP3 files.  For each MP3 file it writes
ID3v2 tags into it.  Here is the archive link:

  http://www.rapideuphoria.com/cgi-bin/search.cgi?keywords=id3adder

The download is only 10k (zipped) which includes documentation.  The bits
you'll be interested in code-wise are the calls to walk_dir in the "main()"
function and the function "look_at()".  Read the Euphoria documentation on
walk_dir as well - it's all pretty easy - much easier than Perl!

Regards,

FP.

At 04:39 PM 1/21/02 +0100, you wrote:
>
>Hi,
>
>I'm new to the Euphoria language. I've written a routine that is too
>slow in Perl and hope Euphoria is faster. I guess this is partly basic
>stuff.
>
>I need to traverse a directory tree, say C:\, and get the filenames,
>directory names.
>
>Then I need to get the status of the file attributes archive/read/ etc
>
>Does anybody have such code already, so I can see whether Euphoria
>might be faster?
>
>Thanks,
>
>Marcus
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Traversing directory and checking attributes

Thanks Freeplay and Chris for pointing me to the directory functions. I
have my first program written which traverses a directory tree and
returns all files with an unset archive attribute. It is many times
faster than the Perl program.

Results for 42,860 files in 3,200 directories:

Perl: 242 seconds

Euphoria: 39 seconds


Marcus

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu