Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADIR() with too many files. Workaround for VFP8.
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01243606
Message ID:
01243637
Vues:
21
You are right. Just thought somebody out there might like to know because it can still serve a useful purpose. In my particular situation, it's fast and useful because I'm only interested in file deletion. I'm scanning folders with thousands of files in them and offering to delete all files older than X days, plus give an idea of approximately how many files are older than those X days. So I need the file dates as well as the file names. For me Adir() is handy for that. If adir()is exceeded, the routine just does a deletion run and doesn't worry about it because invariably most of the files are old enough to get zapped anyway. Next time around, it'll get the rest.

>Mark,
>
>How usefull could be random subset of files?
>
>>* This harvests the max number of files without crashing.
>>* If ADir() crashes, the array is left intact as a 1-D array
>>* so it has to be redimensioned, but what was already loaded stays intact.
>>
>>lExceeded=.F.
>>TRY
>>  nFiles=ADIR(aTheFiles,"X:\MyPath\*.*")
>>CATCH
>>  * Too many files.  Limiting the scan to max files retrieved.
>>  lExceeded=.T.
>>  nFiles=INT(ALEN(aTheFiles) / 5)
>>  IF nFiles > 0
>>    DIMENSION aTheFiles(nFiles,5)
>>  ENDIF
>>ENDTRY
>>* Check lExceeded to determine the outcome of adir()
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform