Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Access file faster
Message
De
06/12/2006 17:57:11
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01175433
Message ID:
01175436
Vues:
7
>Hi friends
>just wondering whats the fastest way to find if a file exist and if so open it.
>the reason ask we've some clients with more 100,000 docs which can be accessed thru our app.
>at the moment find a file and opening a file taking noticeable time.
>btw we are using "file()" command at the moment

Finding if a file exists in a single directory of 100,000 files may be slow, because of the way the operating system works. This has nothing to do with Visual FoxPro: Try to open a DOS command window and give a command like:
dir MyFile.txt
(after selecting the correct directory with the CD command).

If this is too slow, there is a problem with the operating systme.

One thing that can help is to use NTFS as a file system - it seems this uses some sort of file indexing, which should make file access faster.

But in general, it is recommended NOT to have so many files in a single directory. Find a way to split it into separate directory, perhaps by date or by the first letter of the filename.


In Visual FoxPro, file() is known to be unreliable. Specifically, it will say that a file exists, even if it finds the file within the EXE or among the search path. Instead, use:
if adir(SomeArray, "myfile.txt") > 0
  * This means that the file exists
endif
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform