Page 1 of 1

Copy Folder name and File Size to Clipboard

Posted: 30 May 2020 18:01
by victor766
Hi Guys,
Is it possible to copy the folder name and folder size only to clipboard in MB and GB?
e.g

Pictures [25.94GB]
Documents [850MB]

Thanks

Re: Copy Folder name and File Size to Clipboard

Posted: 30 May 2020 18:51
by highend
Only via scripting...

Code: Select all

    $data = "";
    foreach($item, <get SelectedItemsPathNames <crlf>>, <crlf>, "e") {
        if (exists($item) == 1) { continue; }
        $bytes = foldersize($item, "<r>");
        if ($bytes < 1073741824) { $size = round($bytes / (1024 * 1024), 2) . "MB"; }
        else { $size = round($bytes / (1024 * 1024 * 1024), 2) . "GB"; }
        $data .= gpc($item, "base") . " [" . $size . "]" . <crlf>;
    }
    if ($data) { copytext $data; }

Re: Copy Folder name and File Size to Clipboard

Posted: 31 May 2020 06:14
by victor766
highend wrote: ↑30 May 2020 18:51 Only via scripting...

Code: Select all

    $data = "";
    foreach($item, <get SelectedItemsPathNames <crlf>>, <crlf>, "e") {
        if (exists($item) == 1) { continue; }
        $bytes = foldersize($item, "<r>");
        if ($bytes < 1073741824) { $size = round($bytes / (1024 * 1024), 2) . "MB"; }
        else { $size = round($bytes / (1024 * 1024 * 1024), 2) . "GB"; }
        $data .= gpc($item, "base") . " [" . $size . "]" . <crlf>;
    }
    if ($data) { copytext $data; }
Thanks so much! that worked perfectly.