Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Count more than 65,000 files in directory
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00441608
Message ID:
00441675
Views:
30
>I'm working on a data transfer project where ARC files are expanded into new directories and ADIR() is used to return the file names and file count.
>
>When there are more than 65,000 files expanded, VFP 6.0 errors with Too many variables. (array limit reached).
>

No, it's when there are more than 13000 files; 5 columns * 13000 = 65000, the limit of the number of array elements. There's an easy workaround; use the Scripting.FileSystemObject to access the Folder; it produces collections of files and subfolders which can be of any siz3e, and whose counts can be accessed as properties of the Folder object:
oFSO = CREATEOBJ('Scripting.FileSystemObject')
oFolder = oFSO.GetFolder('C:\MyRandomDir')
? oFolder.Files.Count
FOR EACH oFile IN oFolder.Files
   ? oFile.Name
ENDFOR
You might want to look at the articles that George Tasker and I wrote for VFUG about the WSH; www.vfug.org
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform