|
Title | SumSizes |
File Name | SumSizes.txt |
Description | Count total size of files and directories |
Author | Vochomurka |
Parameters | ("%L") |
Plugins Called | int64, miscplugin, file, clip |
Icon | |
Version | 1.1 |
Updated on | 15.06.2006 |
static Sum, List static CR = esc(?+\n+, ?+\+) local Str, Size if(not arg(1)) do Str = "Total size: " ++ Sum ++ " bytes = " ++ int64.divide(Sum, 1000) Str = Str ++ " kbytes = " ++ int64.divide(Sum, 1000000) ++ " Mbytes" messagebox("ok information", List, Str) clip.set(Sum) Sum = 0 List = "" quit endif local fh = file.open(arg(1), "r") if(fh > 0) do for(not(file.eof(fh))) Str = file.readstring(fh) if(Str != 0) do sFileName = Str if(file.isfolder(sFileName)) do Size = miscplugin.fileinfo("foldersize") List = List ++ "<DIR> " else Size = file.size(sFileName) List = List ++ repeat(" ", 11) endif List = List ++ sFileName ++ ", " ++ Size ++ " bytes" ++ CR Sum = ifelse(Sum, int64.Add(Sum, Size), Size) endif endfor else messagebox("ok error", "File not opened", "FILE plugin error") quit endif file.close(fh)
This script can be useful, for instance, to answer the question: "What is the total size of files and folders from different locations, and will my CD-RW have another room for all of them?".
First select file(s) and/or directories to count their total size, and run the script with the "%L" parameter. Then go to other file(s)/dir(s) to count their contribution to the total size, select them, and run the script with the "%L" parameter again, and so on.
After all the information is collected, run the same script with no parameter (or with ""). The dialog box lists all files and directories you have selected, with their sizes. Total size is displayed in the window caption and copied to the clipboard.
Main Page | Total Commander | PowerPro |