I agree with Wayne; thousands of files in a directory is not very efficient. It will slow down the OS.
Anyway, here are more alternatives to obtain a listing.
(1)
Use the DOS command DIR, and output redirection, for example:
run dir /b > files.txt
Type:
dir /?
in the DOS command window to get more options.
Then, you must read in the text-file; for 20,000 lines, you can use StrToFile() and alines(). For more than 65,000 lines, you would have to use LLFF.
(2)
Use sys(2000) in VFP. According to the documentation, it seems that
sys(2000, "*.*") should give you the first file in a directory, then you must repeatedly use
sys(2000, "*.*", 1) until the empty string is returned.
(3)
Depending on how your files are named, you might also use adir() with file skeletons like "a*.*", "b*.*", etc.
>Hi guys,
> I have a program that gets the names of files store in a network directory and puts them in a dbf(table). Am using the function ADIR() to do so but if the records are more than 20,000, I get an error "Too many variables". Is there an alternative to doing so? This is the program :
>
>
>CLOSE DATABASES
>CLOSE TABLES ALL
>
>CREATE TABLE "C:\Documents and Settings\Rndivo.CRC\My Documents\s01A_img.DBF" (FILENUM C(30,0))
>CLOSE TABLES ALL
>
>gnIMAGEnumber = ADIR(gaImages, 'E:\Projects\SCANNED IMAGES\KiBS\01. Screening\01A - ANC Screening Forms\*.TIF')
>
>CLEAR
>USE "C:\Documents and Settings\Rndivo.CRC\My Documents\s01A_img.DBF" IN 1
>FOR nCount = 1 TO gnIMAGEnumber
> APPEND BLANK IN 1
> REPLACE s01A_img.FILENUM WITH gaImages(nCount,1)
>ENDFOR
>CLEAR ALL
>RELEASE ALL
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)