EverythingFolderSize (Use Everything to calculate folder sizes)

Renaming the files and restarting Opus was optional. Refreshing the lister was not. Did you do it?

I checked before, that es.exe works fine. The following code

"C:\PortableApps\Everything\es.exe" -size -no-header -parent "C:\Users\ped\script" /ad -export-csv "Z:\test.txt"

worked fine and test.txt had the correct entries.

Would like to thank you guys for your support, but for reasons I still can't figure out, it's just not working.

If the source code were better documented, I would start troubleshooting, but so for me the effort is disproportionate to the benefit. I think that at least the functions and their parameters (with data types) should be documented. So I feel the code rather as "Quick and Dirty", even if it obviously works for others. But "working" is not everything with code, it should also be readable and maintainable. For this reason, no more help is needed in this regard.

I once took some time (10 min.) to present how I learned it at university a long time ago. I think that a bit more quality in the source code should be a minimum standard. If anyone feels offended by my post here, feel free to delete it by the administrator. I would like it to be understood as constructive criticism.

The following code is only meant as a demo and I don't know if it works like this at all.

// ToDo: describe
// Parameters:
//     initData [DataType] ToDO: describe
function OnInit(initData) {
    initData.name = 'EverythingFolderSize';
    initData.version = '2023-05-02';
    initData.copyright = '';
    initData.url = 'ToDo';
    initData.desc = 'ToDo';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

// ToDo: describe
// Parameters:
//     addColData [DataType] ToDO: describe
function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'EverythingFolderSize';
    col.header = 'EFS';
    // col.label = 'EverythingFolderSize';
    col.method = 'OnColumn';
    col.justify = 'right';
    col.type = 'size';
}

// ToDo: describe
// Parameters:
//     scriptColData [DataType] ToDO: describe
function OnColumn(scriptColData) {
    var item = scriptColData.item;
    var dirVar = 'EFS"' + item + '"';

    if (!item.is_dir) return;

    if (item.path.drive == 0) return;

    if (!DOpus.vars.Exists(dirVar)) return;

    scriptColData.value = DOpus.vars.Get(dirVar);
}

// ToDo: describe
// Parameters:
//     beforeFolderChangeData [DataType] ToDO: describe
function OnBeforeFolderChange(beforeFolderChangeData) {
    cmd.SetSourceTab(beforeFolderChangeData.tab);

    if (!cmd.IsSet('Set COLUMNSTOGGLE=scp:EverythingFolderSize/EverythingFolderSize')) return;

    if (!fsu.Exists(exeES)) return;

    var exportFile = fsu.GetTempFilePath();

    var cmdLine = '"' + exeES + '"' +
        ' -size' +
        ' -no-header' +
        ' -export-csv "' + exportFile + '"' +
        ' -parent "' + beforeFolderChangeData.path + '"' +
        ' /ad';

    // DOpus.Output(cmdLine); // for debugging
    wsh.Run(cmdLine, 0, true);

    var vec = DOpus.Create().Vector(stt.Decode(fsu.GetItem(exportFile).Open().Read(), 'utf8').split('\r\n'));

    var re = /(\d+),(.*)/;

    for (var e = new Enumerator(vec); !e.atEnd(); e.moveNext()) {
        var line = re.exec(e.item());
        if (line == null) continue;
        if (line.length != 3) continue;
        var size = line[1];
        var dirVar = 'EFS' + line[2];
        DOpus.vars.Set(dirVar, size);
    }
}

// *** USER INPUT ***
// The absolute path to the command line interface es.exe
// Important: Everything.exe and es.exe are not the same. See https://www.voidtools.com/support/everything/command_line_interface/
// which also links to where you can download es.exe near the top.
var pathToEsExe = '<path/to/es.exe>'

var cmd = DOpus.Create().Command();
var stt = DOpus.Create().StringTools();
var fsu = DOpus.FSUtil();
var wsh = new ActiveXObject('WScript.Shell');
var exeES = fsu.Resolve(pathToEsExe);

if (!fsu.Exists(exeES)) {
    DOpus.Output('"' + exeES + '" not found!');
}

Are you talking about the documentation of es.exe or directory opus? Opus is highly documented so I assume you mean es.exe. Would like to find some good documentation for es.exe, because it doesn't seem to do everything the main program does.

Also, you showed you aren't hitting f5 to refresh as the final step. Ixp explained that to you maybe you didn't see his post. The f5 thing held me back too, but once I realized that I have to press it every time I enable the column it's been smooth sailing.

I also use es.exe for my custom dialog box which allows me to search for matching folders to move files to across multiple computers on my network. It makes my life so much easier.

Good luck

Is there a way to make the "EFS" column show in bytes instead of GiB/MiB?

I've got mine working with Everything 1.5.0.1352a.

Yes. In ColumnEverythingFolderSize.js.txt, change

col.type = 'size';

to

col.type = 'number';
1 Like

I'd like help to get this functional - I've been using 1.5.0.1351 portable for several years with great success,
but searching the forum today for a way to speed up folder size calculation, I came upon this thread.

  1. Disabled my portable version and installed 1.5.0.1355a.x64 -
    check run Everything as a Service
    check run as Admin
  2. Copied the 2 scripts to "C:\Users\d\AppData\Roaming\GPSoftware\Directory Opus\Script AddIns"
  3. Added both cli.c and es.exe to < "C:\Program Files\Everything 1.5a" >
  4. Changed < Everything-1.5a.ini > to alpha_instance=0
  5. Folder Options > Column > Script > EverythingFolderSize checked/enabled
    ** EFS column Header shows, but column is blank even after restart, F5, etc
  • I did not add any toolbar buttons b/c I want that folder size column always visible & always running.
    EDIT - maybe this is the problem - since I didn't install buttons these scripts haven't been run - so dOpus doesn't do anything?

  • I get an error message running this cmd for export :

C:\Users\d>"C:\Program Files\Everything 1.5a\es.exe" -size -no-header -parent "D:" /ad -export-csv D:\test.txt
Error 8: Everything IPC window not found. Please make sure Everything is running.

Why is Everything IPC window not found? No one else has listed this error so far in this thread.

Well, both Everything service & Everything app are certainly running,
and text.txt is generated but is blank.

Awaiting further instructions, Thanks very much for help

Decided to educate myself on "What is IPC and why is it 'not found'?"
Inter Process Communication, ok.

Search shows voidtools forum entries and I read some posts there - nothing concrete for me.
But I go back into Everything Options > General, scanning the choices, and I notice

"es: URL protocol" - is unchecked, and I think 'maybe this is why things are not communicating?

So after it's checked I refresh and plug in a 5 TB drive nearly full with many many folders/files,
and BAM ! Unbelievable how FAST that EFS column populates - then I immediately attached a 2nd
5 TB x-hdd, also very full, and same thing - just delightfully and unbelievably FAST.

So then I decide to test the command line again. I'm on windows 10 running as Admin,
and when I run cmd.exe I get this error message in the green applet box:

"This app can't run on your PC
To find a version for your PC< check with the software publisher."


So then I run Powershell (stock 5.1.19041.1682) and I get:

At line:1 char:43

  • "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -parent "D ...
  •                                       ~~~~~
    

Unexpected token '-size' in expression or statement.
At line:1 char:49

  • "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -parent "D ...
  •                                             ~~~~~~~~~~
    

Unexpected token '-no-header' in expression or statement.
+ CategoryInfo : ParserError: (:slight_smile: [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken


So even though I have 'success' it seems my setup still has some glitches?


Question - Can I disable the "Size" column and just run this EFS column function
to show sizes (mine show MB and GB, which is what I want)?

I use a 3 internal hdd laptop setup with 17 partitions across the 3 hdds,
so I'm constantly checking and using Size as a criteria in my computing.


I performed the above operations 1 folder level deep on the x-hdd.
Now when I go an additional folder level deep, the EFS column is blank again -
even after F5.

And if I may ask another question - my "Size" column has a nice light green background,
but I don't remember how I got this - I'm sure I set it intentionally, but I can't yet find any setting
in Customize or Preferences?

Thx for help .....

The last issue is the easiest: to launch es.exe from a PS command line, you need to use

Start-Process -FilePath "path\to\es.exe"

The internal wiring seems to be ok. We can dig deeper if you think there's something not quite right yet, I would just need a bit more info.


To completely replace the size column, do the modifications described here:

https://resource.dopus.com/t/everythingfoldersize-use-everything-to-calculate-folder-sizes/44281/56


To color a column, go to Preferences / Display / Fields

Thx @lxp - if I may address the color issue first -

I do see my light green configuration there Thanks!, but when I go Prefs > Display > Fields,
I don't see any entry for the EFS column or ColumnEverythingFolderSize or any other descriptor -
maybe I need to log off to fold in changes?

The bad news:

There's no way to change the text color of a script column currently (other than by changing the default for all columns).

The good news:

We've added that to our to-do list.

https://resource.dopus.com/t/can-you-set-the-color-of-script-columns/36372

Thx, good to know about the colors - and I've added a note about that path to my 68 page long "dOpus config Notes" file :slight_smile:

Well, in the meantime I rebooted, and now the EFS column is blank again! :crazy_face:

If the problem persists, try this version that provides more debug info:

https://resource.dopus.com/t/everythingfoldersize-use-everything-to-calculate-folder-sizes/44281/47

Would you kindly instruct me how-where to 'run' that script for debugging?

Also if it matters - I did uncomment the line DOpus.Output(cmdLine) as you instructed in post

EverythingFolderSize (Use Everything to calculate folder sizes) - #19 by lxp


Also - I just rebooted again and noted the red exclamation SCRIPT error icon in dOpus status bar -
here is the output >

Blockquote
4tb.Py_R" /ad
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error at line 40, position 5
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error 0x800700c1
8/20/2023 3:47 AM UpdateEverythingFolderSize: "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -export-csv "C:\Users\d\AppData\Local\Temp\dop202308200747250405.tmp" -parent "O:-5tb.SQL" /ad
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error at line 40, position 5
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error 0x800700c1
8/20/2023 3:47 AM UpdateEverythingFolderSize: "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -export-csv "C:\Users\d\AppData\Local\Temp\dop202308200747330492.tmp" -parent "J:" /ad
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error at line 40, position 5
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error 0x800700c1
8/20/2023 3:47 AM UpdateEverythingFolderSize: "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -export-csv "C:\Users\d\AppData\Local\Temp\dop202308200747400861.tmp" -parent "O:-5tb.SQL" /ad
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error at line 40, position 5
8/20/2023 3:47 AM UpdateEverythingFolderSize: Error 0x800700c1
8/20/2023 3:52 AM UpdateEverythingFolderSize: "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -export-csv "C:\Users\d\AppData\Local\Temp\dop202308200752160622.tmp" -parent "O:-5tb.SQL" /ad
8/20/2023 3:52 AM UpdateEverythingFolderSize: Error at line 40, position 5
8/20/2023 3:52 AM UpdateEverythingFolderSize: Error 0x800700c1
8/20/2023 6:05 AM UpdateEverythingFolderSize: "C:\Program Files\Everything 1.5a\es.exe" -size -no-header -export-csv "C:\Users\d\AppData\Local\Temp\dop202308201005260960.tmp" -parent "N:-4tb.Py_R" /ad
8/20/2023 6:05 AM UpdateEverythingFolderSize: Error at line 40, position 5
8/20/2023 6:05 AM UpdateEverythingFolderSize: Error 0x800700c1

Error 0x800700c1 points to some Windows problems. Could that be the case?

Try disabling "Run Everything as Admin". Maybe that stops Opus from getting the info from Everything.

The rest looks good :slight_smile:

Nope - even after rebooting it's still blank.

I'll ask again b/c I'm unsure - do I need to make a button w/ script and run it so that dOpus internally stores the script in some way that's not happening for me at present?

I'm also thinking to post on voidtools forum and ask Mr. Carpenter if he might help.

The Opus side looks fine. We are getting the error while asking es.exe to send us the size info. Something's wrong with Everything or the OS. Unfortunately, I am running out of ideas about where to look.... Re-install Everything? Clean the /temp? Run Windows-Update? If you ask in the Voidtools forum, include the error number.

Older versions of es.exe also don't return results.

Maybe try your portable installation. I updated the main post with some info on how to do it.

Thank you sir - I may try that later tonite - I've had a response from NotNull on void forum,
and I'm awaiting his next reply to my execution of his instructions.

It'll be handy to have that portable info -
yesterday I thought I'd have better chances for success if I went the regular install route.

It's working now - again -

Incredulous - I go back to look in the "C:\Program Files\Everything 1.5a" folder,
and suddenly I notice es.exe shows a Size of -0- ! How the heck did THAT happen?

Regardless, I copied over the downloaded es.exe to replace it, and F5 and BANG it works again! PTL!

Now there's a slight different problem - a better one I think - -
Now when I run the 2 commands, here's the output :

C:\Program Files\Everything 1.5a>es.exe -instance 1.5a everything ext:exe
Error 8: Everything IPC window not found. Please make sure Everything is running.

C:\Program Files\Everything 1.5a>es.exe everything ext:ini
C:\Program Files\Everything 1.5a\Everything-1.5a.ini
C:\Users\d\AppData\Roaming\Everything\Everything-1.5a.ini
D:\z...sager!...Everything-1.5.0.1304a.x64.p\Everything-1.5a.ini

C:\Program Files\Everything 1.5a>

The D:\z...sager\ listing is my portable - which is disabled in favor of the installed version to make this work w/ dOpus.