Copy Folder name and File Size to Clipboard

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
victor766
Posts: 2
Joined: 30 May 2020 17:57

Copy Folder name and File Size to Clipboard

Post 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

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Copy Folder name and File Size to Clipboard

Post 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; }
One of my scripts helped you out? Please donate via Paypal

victor766
Posts: 2
Joined: 30 May 2020 17:57

Re: Copy Folder name and File Size to Clipboard

Post 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.

Post Reply