cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ravnstorm
Level 4

InstallScript Help - Traversing directory tree and getting file list gives duplicates

I'm trying to get the size of a large folder - 17.1 GB. The folder has 53 subfolders and 386 files. To begin with, I'm trying to traverse the directory tree and get the file sizes of each of the files. Currently, I'm just writing the information to a file for troubleshooting. The problem is that it is going back and traversing some folders again, and I can't figure out why!!! The results should show that there are 53 folders and 386 files. Instead it gets 53 folders and 1057 files. Can anyone see what is wrong with the FindAllFiles loop in the script attached?
Labels (1)
0 Kudos
3 Replies
ravnstorm
Level 4

I think I found the answer. Some of the subfolders are parent folders, that don't have files, but they have more subfolders. I was able to get the right list of files by first gathering a list of only directories that had actual files in them. It's dumb, but adding the attached changes worked. (Attachment doesn't include the variable declarations, etc)
0 Kudos
MarkusLatz
Level 8

Here is another sample:

Get Size of All Files in a Directory:

http://www.installsite.org/files/GetDirFileSize.zip

from this site:

http://www.installsite.org/pages/en/isp_comp.htm

regards

Markus
0 Kudos
ravnstorm
Level 4

Thank you for checking into this and replying.
0 Kudos