Show folder sizes via Everything

Discuss and share scripts and script files...
Post Reply
highend
Posts: 13338
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Show folder sizes via Everything

Post by highend »

Prerequisites:
- Use at least v25.60.0107 or newer!
- Enable this setting: Configuration | General | Refresh, Icons, History | Scripting | [x] Remember permanent variables
- Use Everything 1.5 Alpha (https://www.voidtools.com/forum/viewtopic.php?t=9787)
In Everything, from the Tools menu, click Options...
Click the Indexes tab on the left
Check Index folder size
Click OK
- Make sure you have
alpha_instance=0
in your Everything .ini file
If the key doesn't exist, append this entry as the last line

Setup
Edit this script by changing the path to your es.exe file in the first line
es.exe can be downloaded from here: https://www.voidtools.com/downloads/
When done, use it for:
Configuration | General | Custom Event Actions | Changing Locations | Before browsing a folder | Script
Or course you need to set the Action for that event to Run script!

Code: Select all

    $es = "D:\Tools\Everything_x64\es.exe";

    perm $P_EV_DATA;
    if (exists($es) != 1) { trayballoon "MISSING!<crlf 2>$es", , 3+16, 0; end true; }
    if (exists(<newpath>) != 2) { $P_EV_DATA = ""; end true; }
    $command   = quote($es) . " parent:" . quote(<newpath>). " /ad -size -no-header -csv";
    $P_EV_DATA =  runret("""cmd"" /c chcp 65001 >NUL & $command", "%TEMP%", 65001);
Now run ::snippet; from the address bar
Paste this into the snippet window and use the OK button

Code: Select all

Snip: CustomColumn 1
  XYplorer 25.80.0007, 02.04.2024 09:48:22
Action
  ConfigureColumn
Caption
  FSize
Type
  3
Definition
      // -1 = Error while collecting data; -2 = No data collected yet; -3 = Folder size not found
      if (!$P_EV_DATA)                { return -1; }
      if ($P_EV_DATA == '$P_EV_DATA') { return -2; }
      $esc   = regexreplace(<cc_item>, "([\\^$.+()\[{])", "\$1");
      $match = regexmatches($P_EV_DATA, "^\d+?,[""]$esc[""]");
      if ($match) { return formatbytes(gettoken($match, 1, ',"'), "MB"); }
      return -3;
Format
  0
Trigger
  0
Item Type
  1
Item Filter
  
In the if ($match) { line "MB" is used.
You can change this to anything that is supported by
formatbytes(), e.g. "FLEX" but if you want to be able
to sort via this column, "FLEX" can be a bad choice...

Add this column to your layout...
One of my scripts helped you out? Please donate via Paypal

Post Reply