You confuse iterating through the list with altering the contenst of the list.
Initially the list will not contain duplicates (if it does, your filesystem is f*cked up).
you assume that the iteration is of directories and not files while the files might not be doublicates the directories are the same for all files in it. thing of it like extrafiledirectory will produce duplicates for any file in the same directory
That makes no sense to me at all.
If List (TStringList) is the first parameter of FindAllFiles(), then there will be NO duplicates in List ever.
You should not add every directory you get with ExtractFilePath to yet another TStringList, since it may already be in there (unfortunately List will not be sorted in such a way that all files in a folder are listed before the next folder is processed).
I attached a demo program that counts the files.
It uses a second stringlist for the counting (not very efficient, I know), and when the filepath changes (from one entry to another) it first checkes if we already have counted some files from that folder before it continues.
It will display all found files (in the current directory) in the left memo, and the result of counting in the right one.
Bart