Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADIR() on a very large directory
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00967881
Message ID:
00967908
Views:
11
>I need to know the name of every single file in a directory
>
>I'm trying to run adir() in a very large directory about 100,000 files; the problem is that VFP array limit is 65,000 elements, so the names of the files do not fit in the array (I get an invalid subscript reference error).
>
>I could do "DIR *.* to file DIR.TXT" then extract the names from the text file. Is there any easyer way to get all the file names in the directory? or better in a string variable separated by commas?
>
>Thanks in advance

If you only need the files on one particular directory, SYS(2000) as others have pointed, should be OK, but, if you need to recurse directories, I would use WSH instead of SYS(2000), or a mix of WSH and SYS(2000), for SYS(2000) does not, AFAIK, return subdirectories, and ADIR does return directories, but not directories ONLY.

Something like:
function AnalizeFolder(tcRootDir)
loFolder	= loFSO.GetFolder(tcRootDir)
for each loSubFolder in loFolder.SubFolders
	AnalizeFolder(loSubFolder.Path)
	AnalizeFiles(loFolder)
endfor
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform