Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the total numbers of files of a folder
Message
From
03/10/2005 12:51:09
 
 
To
03/10/2005 11:38:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01055451
Message ID:
01055555
Views:
10
>>It's a collection of pictures from one of my suppliers. In our own system, we have these pictures divided into 100 subdirectories, for faster access. But for reference, I also keep the original files in their own subdirectory.
>
>I understand that NTFS uses indexes on its directories. In my own informal tests, access is quite fast, even if there are many files in a directory.
>
>Do you think that there is still a significant speed difference in this case? Or do you want to make sure that the system also works decently on FAT?

The files are on a WIN2K server, and when we rearranged the pictures, we noticed that the access to the pictures was a little bit faster. We never took the time to analyze this, because the new structure was much more "tidy". All the pictures have names consisting of eight digits, ranging from 10000000 to 99999999, and all the records are in the directory which corresponds to the first two digits. So file 12345678.jpg is in directory 1\2, file 34567890.gif is in 3\4, and so on. In my table I simply store this eight digit number, and I have this simple function to get to the complete filename including path
Function pictfile
Lparameters lcPicture,lcPath
If Pcount()=1 or vartype(lcPath)#'C'
  lcPath='P:\DATA\Pictures\' && default "root" directory for the pictures
EndIf
If Vartype(lcPicture)='N'
  lcBilde=n2c(lcPicture)
EndIf 
Local lcReturn,lcValue,lcFilename
lcReturn=''
If !Empty(lcPicture)
  lcValue=Ltrim(lcPicture)
  If Empty(Justext(lcPicture))
    If Adir(laDummy,lcPath+Substr(lcValue,1,1)+'\'+Substr(lcValue,2,1)+'\'+lcValue+'.*')>0
      lcReturn=lcPath+Substr(lcValue,1,1)+'\'+Substr(lcValue,2,1)+'\'+laDummy(1)
    Endif
  Else
    lcReturn=lcPath+Substr(lcValue,1,1)+'\'+Substr(lcValue,2,1)+'\'+lcPicture
  Endif
Endif
Return lcReturn
BTW, n2C is a modified STR() function I wrote a million years ago.

Another factor is that if you have a lot of files in a directory, and you accidentally point to that directory in Explorer, you can just as well go and get a cup of coffee.
Previous
Reply
Map
View

Click here to load this message in the networking platform