# Number of files in selected zip or archive files

**URL:** <https://resource.dopus.com/t/number-of-files-in-selected-zip-or-archive-files/57418>\
**Category:** Help & Support\
**Created:** [October 8, 2025, 7:06am UTC](https://resource.dopus.com/t/number-of-files-in-selected-zip-or-archive-files/57418 "2025-10-08T07:06:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lxp](https://resource.dopus.com/user_avatar/resource.dopus.com/lxp/32/33734_2.png) [@lxp](https://resource.dopus.com/u/lxp)\
**Post date:** [October 8, 2025, 3:16pm UTC](https://resource.dopus.com/t/number-of-files-in-selected-zip-or-archive-files/57418/2 "2025-10-08T15:16:03Z")

</div>

> [@ddjksa](#):
>
> is there an easy way

Not super easy, but doable. A script can sum up the values, store the result in a variable, and display it in a button or the status bar.

Here's a script and a button. The column needs to be visible for the script to work.

```javascript
function OnInit(initData) {
    initData.name = 'SumFileCountTotal';
    initData.version = '2025-10-08';
    initData.url = 'https://resource.dopus.com/t/number-of-files-in-selected-zip-or-archive-files/57418/2';
    initData.desc = 'SumFileCountTotal';
    initData.default_enable = true;
    initData.min_version = '13.0';
}

function OnAddCommands(addCmdData) {
    var cmd = addCmdData.AddCommand();
    cmd.name = 'SumFileCountTotal';
    cmd.method = 'OnSumFileCountTotal';
    cmd.desc = 'SumFileCountTotal';
    cmd.label = 'SumFileCountTotal';
    cmd.hide = false;
    cmd.icon = 'script';
}

function OnSumFileCountTotal(scriptCmdData) {
    var cmd = scriptCmdData.func.command;
    var tab = scriptCmdData.func.sourcetab;

    if (!tab) return;

    var sumFileCountTotal;

    if (tab.selected_files.count > 0) {
        sumFileCountTotal = 0;
        for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
            var item = e.item();
            if (!item.InGroup('Archives')) continue;
            var fct = item.metadata.other.filecounttotal;
            if (typeof fct != 'number') continue;
            if (isNaN(fct)) continue;
            sumFileCountTotal += fct;
        }
    } else {
        sumFileCountTotal = '---';
    }

    tab.Vars.Set('SumFileCountTotal', sumFileCountTotal);
    // DOpus.Output('SumFileCountTotal: ' + sumFileCountTotal);

    cmd.UpdateToggle();
}

```

Save [CommandSumFileCountTotal.js.txt](https://resource.dopus.com/uploads/short-url/wtKyI6va2a1ZFIcpiLZ2sIgK24D.txt) to   ↓

```plaintext
%appdata%\GPSoftware\Directory Opus\Script AddIns

```

```plaintext
@label:="SFCT: " + $tab:SumFileCountTotal
Set COLUMNSADD=filecounttotal
SumFileCountTotal

```

> **XML**
>
> ```plaintext
> <?xml version="1.0"?>
> <button backcol="none" display="both" label_pos="right" textcol="none">
> <label>SFCT</label>
> <icon1>#newcommand</icon1>
> <function type="normal">
> <instruction>@label:=&quot;SFCT: &quot; + $tab:SumFileCountTotal</instruction>
> <instruction>Set COLUMNSADD=filecounttotal</instruction>
> <instruction>SumFileCountTotal</instruction>
> </function>
> </button>
> 
> ```

[How to use buttons and scripts from this forum](https://resource.dopus.com/t/how-to-use-buttons-and-scripts-from-this-forum/3546)

> [@ddjksa](#):
>
> I'm using V13.10 x64 Build 9004

This version is over a year old. Treat yourself to something [fresh](http://www.gpsoft.com.au/download/release) 🙂

---

_[View the full topic](https://resource.dopus.com/t/number-of-files-in-selected-zip-or-archive-files/57418)._
