Summary
This article provides InstallScript code that will find the total size of the files in a particular path and all of its subfolder
Synopsis
This article provides InstallScript code that will find the total size of the files in a particular path and all of its subfolder. The following sample code searches the directory G:\Games, including all subfolders, total the file size in the variable called Total, and display the totals in a message box. The FindAllFiles and GetFileInfo Installscript functions are used. This article applies to Basic MSI, InstallScript and InstallScript MSI Project Types.
Discussion
The following is the InstallScript code:
function FindFiles()
STRING svResult, svFirstFolder, svPath;
NUMBER nResult, nvResult, Total;
begin
Total = 0;
svFirstFolder = "G:\\Games";
nResult = FindAllFiles ( svFirstFolder , "*.*" , svPath , RESET );
while (nResult >= 0)
GetFileInfo ( svPath , FILE_SIZE , nvResult , svResult );
Total = Total + nvResult;
nResult = FindAllFiles ( svFirstFolder , "*.*" , svPath , CONTINUE );
endwhile;
SprintfBox ( INFORMATION , "" , "Total is %d bytes" , Total );
Total = Total / 1024;
SprintfBox ( INFORMATION , "" , "Total is %dKB" , Total );
end;
Additional Information
For more information on the FindAllFiles and GetFileInfo functions, see the InstallShield Help Library topic FindAllFiles and GetFileIn/fo.
Related Articles
Adding Prerequisite Files That Contains Subfolders 4Number of Views Force the Installer to Use a Particular JVM 4Number of Views Could not open configuration file C: Program Files (x86)\\<vendorName>lmadmin/conf/httpd.conf: The system cannot find the … 7Number of Views How do I Order The SQL Script Generated by Installshield to Input Data to The Tables in a Particular Order? 22Number of Views What is the Maximum Size of the Log File? 8Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add additional feedback (optional)
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
|
FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513
(toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367
(toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895
2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago