# Unable to get the file size of multiple files using Advanced FTP node

**URL:** https://discourse.nodered.org/t/unable-to-get-the-file-size-of-multiple-files-using-advanced-ftp-node/80121
**Category:** General
**Created:** [27 July 2023 14:49 UTC](https://discourse.nodered.org/t/unable-to-get-the-file-size-of-multiple-files-using-advanced-ftp-node/80121 "2023-07-27T14:49:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![PS2525](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@PS2525](https://discourse.nodered.org/u/PS2525)
#### Post date: [27 July 2023 14:49 UTC](https://discourse.nodered.org/t/unable-to-get-the-file-size-of-multiple-files-using-advanced-ftp-node/80121/1 "2023-07-27T14:49:09Z")

</div>

I am getting file size for single filename from my remote FTP using Advanced FTP node which is working fine.  
But Now I wanted to get the file size of 7 files which needs to send to FTP node one by one and save it in an array and then show as a result of filenames and their size. I tried many logics but didn't work.  
It is not feasible to get the list of directory every time and compare it with the require files available in my local directory.  
I would be grateful if someone can suggest me a solution.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 July 2023 17:37 UTC](https://discourse.nodered.org/t/unable-to-get-the-file-size-of-multiple-files-using-advanced-ftp-node/80121/2 "2023-07-28T17:37:20Z")

</div>

> [@PS2525](#):
>
> But Now I wanted to get the file size of 7 files which needs to send to FTP node one by one and save it in an array and then show as a result of filenames and their size.

I suggest fs-ops to the rescue.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/6/76eb34e8513042a1c120ac0ec23ea70170383fb1.png)

Demo Flow (use `CTRL+I` to import)

```auto
[
    {
        "id": "44568381f16b99bc",
        "type": "inject",
        "z": "6429d72ae185e590",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 1210,
        "y": 100,
        "wires": [
            [
                "a742fc1c40ebb3fb"
            ]
        ]
    },
    {
        "id": "87800c16b499cd24",
        "type": "function",
        "z": "6429d72ae185e590",
        "name": "Summary of files",
        "func": "\n/** @type {[Number]} */\nconst stats = msg.stats\n\nconst byteSize = stats.reduce(function (a, b) {\n return a + b.size\n}, 0);\n\n\nmsg.payload = {\n files: msg.files,\n stats: msg.stats,\n totalBytes: byteSize,\n totalKBs: (byteSize / 1000).toFixed(3)\n}\n\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1320,
        "y": 160,
        "wires": [
            [
                "1f7871d95c546042"
            ]
        ]
    },
    {
        "id": "a742fc1c40ebb3fb",
        "type": "fs-ops-dir",
        "z": "6429d72ae185e590",
        "name": "",
        "path": "c:/temp",
        "pathType": "str",
        "filter": "*.zip",
        "filterType": "str",
        "dir": "files",
        "dirType": "msg",
        "x": 1360,
        "y": 100,
        "wires": [
            [
                "21f451c9ccd00507"
            ]
        ]
    },
    {
        "id": "21f451c9ccd00507",
        "type": "fs-ops-stats",
        "z": "6429d72ae185e590",
        "name": "",
        "path": "c:/temp",
        "pathType": "str",
        "filename": "files",
        "filenameType": "msg",
        "stats": "stats",
        "sizeType": "msg",
        "x": 1510,
        "y": 100,
        "wires": [
            [
                "87800c16b499cd24"
            ]
        ]
    },
    {
        "id": "1f7871d95c546042",
        "type": "debug",
        "z": "6429d72ae185e590",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1510,
        "y": 160,
        "wires": []
    }
]

```

---

<div class="post-metadata">

### Author: ![PS2525](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@PS2525](https://discourse.nodered.org/u/PS2525)
#### Post date: [31 July 2023 09:13 UTC](https://discourse.nodered.org/t/unable-to-get-the-file-size-of-multiple-files-using-advanced-ftp-node/80121/3 "2023-07-31T09:13:50Z")

</div>

Thanks!  
However using fs-ops I can access only the local files only. I want to get the size of the files from my remote server which can only possible by FTP nodes.  
But now I have figured out another solution and is working fine.  
One again thank you so much!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [29 September 2023 09:14 UTC](https://discourse.nodered.org/t/unable-to-get-the-file-size-of-multiple-files-using-advanced-ftp-node/80121/4 "2023-09-29T09:14:15Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
