GetFileSize() and directories
Hi,
I'm trying to get the size of a directory and I came up with two ways...
1. I used FindFirstFile() and FindNextFile() and searched the directory tree for files, adding the size of each file and finally getting the directory size.
2. I opened the directory with CreateFile() using the FILE_FLAG_BACKUP_SEMANTICS flag and then called GetFileSize() with the handle returned from CreateFile(). Even though MSDN says that one can pass such handles to GetFileSize(), the function keeps returning 0 and GetLastError() returns 0 indicating no error has occurred.
I can't really understand why GetFileSize() returns 0 instead of the actual directory size, so if anyone has some answers or any other methods of getting the size of a directory that would be great.
Thanks.