# \`file out\` node wrong path

**URL:** <https://discourse.nodered.org/t/file-out-node-wrong-path/55169>\
**Category:** General\
**Created:** [14 December 2021 12:06 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169 "2021-12-14T12:06:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 December 2021 12:06 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/1 "2021-12-14T12:06:39Z")

</div>

I have this bit of code:

```auto
[{"id":"1eae07ed.d651f8","type":"change","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"path","rules":[{"t":"set","p":"path","pt":"msg","to":"log_paths","tot":"global"},{"t":"set","p":"filename","pt":"msg","to":"reboot_logs.txt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":2240,"wires":[["799a0ae4.20f21c"]]},{"id":"799a0ae4.20f21c","type":"file","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"Log boot","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1120,"y":2240,"wires":[[]]}]

```

So given the `global` context is set why is the file being created in `~` as `reboot_logs.txt`?  
it should be `msg.path` set to `global.log_paths`.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 December 2021 12:14 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/2 "2021-12-14T12:14:30Z")

</div>

Ok....

Studied.

This is correct - yes?

```auto
[{"id":"799a0ae4.20f21c","type":"file","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"Log boot","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":1150,"y":2240,"wires":[[]]},{"id":"26943207a7d686da","type":"function","z":"a1911aa3.c45be8","g":"b924568e.8a90a8","name":"Set path/file","func":"var path = global.get(\"log_paths\");\nmsg.filename = path + \"reboot_logs.txt\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":980,"y":2240,"wires":[["799a0ae4.20f21c"]]}]

```

So you can't use `change` nodes where you set `msg.filename` and `msg.path` and they work any more?

I'm sure they used to.

Though it may explain a couple of rogue files I've found.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 December 2021 12:27 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/3 "2021-12-14T12:27:08Z")

</div>

> [@Trying\_to\_learn](#):
>
> So you can't use `change` nodes where you set `msg.filename` and `msg.path` and they work any more?

The FIle Out node has _never_ used `msg.path` to set the path. It only uses `msg.filename`.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 December 2021 12:29 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/4 "2021-12-14T12:29:05Z")

</div>

Ok, thanks.

I'm a bigger idiot than I thought.

So the latter is correct? Just wanting to triple check.

---

<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:** [14 December 2021 12:35 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/5 "2021-12-14T12:35:04Z")

</div>

Always remember to read the help 🙂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/4/f4b7840fec2efbad15c4ad9b4107baa46c7de1bd.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [14 December 2021 12:36 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/6 "2021-12-14T12:36:06Z")

</div>

> [@Trying\_to\_learn](#):
>
> So the latter is correct? Just wanting to triple check.

Not sure which 'latter' you are refering to at this point.

> [@Trying\_to\_learn](#):
>
> So you can't use `change` nodes where you set `msg.filename` and `msg.path` and they work any more?

You can use the Change node to set any property to anything. You could use a Debug node to verify the properties are being set, rather than assume the node has stopped working.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 December 2021 12:42 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/7 "2021-12-14T12:42:00Z")

</div>

But that's just it.

I was sure I did.

Somehow another node must/could have done it and I goofed when _translating_ sending messages to this node.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [14 December 2021 12:42 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/8 "2021-12-14T12:42:23Z")

</div>

I think I just cocked up big time.

---

<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:** [28 December 2021 12:43 UTC](https://discourse.nodered.org/t/file-out-node-wrong-path/55169/9 "2021-12-28T12:43:04Z")

</div>

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