Total Folder size
This taught me a new trick in xtscript
<!--parser:xtscript-->
var $list = <xt:filelist folder="/my_folder/files" template=".file_size_mb." per_page="" />
var $list= call str_replace $subject=$list;$search=MB;$replace=+
var $list=($list)
print $list MB
<!--/parser:xtscript-->
Copy code
var $list = <xt:filelist folder="/my_folder/files" template=".file_size_mb." per_page="" />
var $list= call str_replace $subject=$list;$search=MB;$replace=+
var $list=($list)
print $list MB
<!--/parser:xtscript-->
Copy code
The filelist xt function creates a list of the sizes of all the files in the folder in megabytes
ie: 1.05MB2.34MB0.99MB3.04MB
the str_replace replaces the MB with a + sign
the $list=($list) evaluates $list as maths (because it is in brackets) so it adds all the values together
then you print out the result
This also works if you leave out
var $list=($list)
and use
print ($list) MB
instead