# Problems renaming using SFTP node and variable file names

**URL:** <https://discourse.nodered.org/t/problems-renaming-using-sftp-node-and-variable-file-names/82749>\
**Category:** General\
**Created:** [9 November 2023 23:18 UTC](https://discourse.nodered.org/t/problems-renaming-using-sftp-node-and-variable-file-names/82749 "2023-11-09T23:18:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregHNZ](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@GregHNZ](https://discourse.nodered.org/u/GregHNZ)\
**Post date:** [9 November 2023 23:18 UTC](https://discourse.nodered.org/t/problems-renaming-using-sftp-node-and-variable-file-names/82749/1 "2023-11-09T23:18:06Z")

</div>

Trying to rename (and put) files on an SFTP server.  
This works if the names are hardcoded into the node, but when trying to use variables to drive source and destination names in a prior function, "Error: No such file" is raised. using [node-red-contrib-sftp](https://flows.nodered.org/node/node-red-contrib-sftp)

Any ideas on how to pass the src/dest as variables?

```auto
[
    {
        "id": "9621641beda81abd",
        "type": "debug",
        "z": "7c0ebce243632905",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 900,
        "y": 860,
        "wires": []
    },
    {
        "id": "e0714f71d3e36c17",
        "type": "SFTP-main",
        "z": "7c0ebce243632905",
        "path": "/",
        "method": "rename",
        "remoteFilePath": "",
        "localFilePath": "/",
        "remoteDestPath": "",
        "useCompression": "",
        "encoding": "utf8",
        "mode": "",
        "recursive": "false",
        "server": "5aa1834ab03a65fd",
        "x": 590,
        "y": 840,
        "wires": [
            [
                "9621641beda81abd"
            ]
        ]
    },
    {
        "id": "24702feb8b9877d2",
        "type": "inject",
        "z": "7c0ebce243632905",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 840,
        "wires": [
            [
                "96b663a84c8f0d61"
            ]
        ]
    },
    {
        "id": "96b663a84c8f0d61",
        "type": "function",
        "z": "7c0ebce243632905",
        "name": "function 8",
        "func": "\n\nmsg.remoteSourcePath ='/u/awards/spool/NEWELL_BRANDS/out/pending/is08459888.txt';\nmsg.remoteDestPath ='/u/awards/spool/NEWELL_BRANDS/out/pending/__is08459888.txt';\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 400,
        "y": 840,
        "wires": [
            [
                "e0714f71d3e36c17"
            ]
        ]
    },
    {
        "id": "82c6c81e484422fd",
        "type": "SFTP-main",
        "z": "7c0ebce243632905",
        "path": "/",
        "method": "rename",
        "remoteFilePath": "/u/awards/spool/NEWELL_BRANDS/out/pending/is08459888.txt",
        "localFilePath": "/",
        "remoteDestPath": "/u/awards/spool/NEWELL_BRANDS/out/pending/__is08459888.txt",
        "useCompression": "",
        "encoding": "utf8",
        "mode": "",
        "recursive": "false",
        "server": "5aa1834ab03a65fd",
        "x": 590,
        "y": 920,
        "wires": [
            [
                "9621641beda81abd"
            ]
        ]
    },
    {
        "id": "8ac06aa0844fa856",
        "type": "inject",
        "z": "7c0ebce243632905",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 920,
        "wires": [
            [
                "82c6c81e484422fd"
            ]
        ]
    },
    {
        "id": "5aa1834ab03a65fd",
        "type": "SFTP-credentials",
        "host": "10.233.238.142",
        "port": "22",
        "username": "sistema",
        "password": "dexion2020"
    }
]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [9 November 2023 23:34 UTC](https://discourse.nodered.org/t/problems-renaming-using-sftp-node-and-variable-file-names/82749/2 "2023-11-09T23:34:56Z")

</div>

Yup might want to try a different node. If you follow the link you provided, and then follow the `View in GitHub` link for the node, you will see it hasn’t been updated in over 5 years and there are two issues that are still open. My guess is the author has abandoned the node but you could open an issue and see if you get a reply.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 November 2023 11:47 UTC](https://discourse.nodered.org/t/problems-renaming-using-sftp-node-and-variable-file-names/82749/3 "2023-11-10T11:47:08Z")

</div>

I have had significant problems with FTP nodes in the past. Now I use an exec node to run command line ftp commands to do what I want.

---

<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:** [9 January 2024 11:47 UTC](https://discourse.nodered.org/t/problems-renaming-using-sftp-node-and-variable-file-names/82749/4 "2024-01-09T11:47:11Z")

</div>

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