My application launches a 3rd party program (in a hidden window) that downloads some files into a folder.
I want my application to report back on the progress. I am running a TIMER that calls the function below to get the folder size every 1000ms and displays it.
Its returned value doesn't change - its as if its cached or something. If I go into the folder with windows, refresh its contents - F5 - my application's folder size is updated. But if I don't do that - it just sits there with the "old" information.
How can I get it to give me the most up-to-date size every second?
- Code: Select all Expand view
- STATIC FUNCTION GetFolderSize(cPath)
//Returns the total filesize of a folder cPath
LOCAL adir, nfoldersize,i
aDir = DIRECTORY( cPath + "\*.*", "D" )
nFolderSize = 0
FOR i = 1 TO LEN( aDir )
nFolderSize += aDir[ i, 2 ]
//1 = Filename
//2 = Filesize
NEXT
//? "Folder Size: "+STR(nFolderSize)
RETURN (nFolderSize)