|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
file counting
mauro russo wrote:
is it possible to obtain the number of files in a directory (no sub-directories) without to enumerate all files, for example as FindFirst and FindNext? No. You have to count them. A TFileListBox would be overkill. Even if it works non-visually, it still needs to do all the work of enumerating the directory, and then it has the overhead of storing the file information that you apparently don't need. When counting the files, make sure you remember to ignore the current and parent directories (. and ). -- Rob |
|
#2
|
|||
|
|||
|
file counting
mauro russo wrote:
Rob Kennedy wrote: >mauro russo wrote: is it possible to obtain the number of files in a directory (no sub-directories) without to enumerate all files, for example as FindFirst and FindNext? >> >No. You have to count them. > how to be sure the files are read in alphabetical arrangement? As the documentation for FindFirstFile says, if you want the files in a particular order, you need to get all the names first and then put them into the desired order yourself. FindFirstFile and FindNextFile return files in whatever order the filesystem driver provides them. It might be alphabetical, it might be the order in which they were created, or it might be any other order you can think of. But why does the order matter? You're only counting them. You'll get the same number no matter what order they're in. -- Rob |
![]() |
| Viewing: Web Development Archives > Mailing Lists > Delphi > file counting |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|