Web Connection
Shell32 (or faster) for listing all files in a directory
Gravatar is a globally recognized avatar based on your email address. Shell32 (or faster) for listing all files in a directory
  Michael Hogan (Ideate Hosting)
  All
  Apr 16, 2024 @ 12:20pm

I am hoping and expecting that there is a faster way to get a list of around 24,000 files in a directory than ADIR() - I'm having trouble finding a Shell32 equivalent in the hopes of finding something faster.

Gravatar is a globally recognized avatar based on your email address. re: Shell32 (or faster) for listing all files in a directory
  Rick Strahl
  Michael Hogan (Ideate Hosting)
  Apr 16, 2024 @ 02:34pm

I don't think you'll get good performance out of any folder that has that many files in it - the issue is Windows itself being slow to retrieve the directory listing if I remember.

There's a FindFirstFile() API that you can use to iterate through files - it doesn't retrieve it just gives you one file at a time so you can pull out what you need so you don't automatically create a huge array of all the files, but you only take what you need. But honestly I don't think that's the problem - the directory itself the slowness. For example, Explorer slows to a crawl if you access a folder with that many files.

Also you can try .NET... System.IO.Path.Directory.GetFiles() with wwDotnetBridge. But that too will give you an in memory list plus COM overhead most likely.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Shell32 (or faster) for listing all files in a directory
  Tore Bleken
  Michael Hogan (Ideate Hosting)
  Apr 16, 2024 @ 07:11pm

Check out SYS(2000)

Gravatar is a globally recognized avatar based on your email address. re: Shell32 (or faster) for listing all files in a directory
  Rick Strahl
  Tore Bleken
  Apr 16, 2024 @ 07:49pm

Check out SYS(2000)

Ah yes, that's right - this is FoxPro's wrapper around the FindFirstFile() API.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Shell32 (or faster) for listing all files in a directory
  Michael Hogan (Ideate Hosting)
  Rick Strahl
  Apr 17, 2024 @ 04:34am

Thanks for the feedback.

I did find that ADIREx from vfp2c32.fll is twice as fast as ADIR() on the live server - but I'm hoping to convince the customer to pre-populate and update a DBF every few hours (or run an out-of-process exe upon login).

https://github.com/ChristianEhlscheid/vfp2c32

All the other options I tried were slower.

© 1996-2024