# How to pass msg.path + msg.filename to file-in node?

**URL:** <https://discourse.nodered.org/t/how-to-pass-msg-path-msg-filename-to-file-in-node/38886>\
**Category:** General\
**Created:** [10 January 2021 11:22 UTC](https://discourse.nodered.org/t/how-to-pass-msg-path-msg-filename-to-file-in-node/38886 "2021-01-10T11:22:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bird](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bird/32/34966_2.png) [@bird](https://discourse.nodered.org/u/bird)\
**Post date:** [10 January 2021 11:22 UTC](https://discourse.nodered.org/t/how-to-pass-msg-path-msg-filename-to-file-in-node/38886/1 "2021-01-10T11:22:44Z")

</div>

hi

The msg.path and msg.filename are transferred to the file-in node.  
I want to set "msg.path" + "/" + "msg.filename" as the filename of the file-in node.

I tried {{{msg.path}}} and {{msg.path}} but it didn't work.

Thank you.

---

<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:** [10 January 2021 11:26 UTC](https://discourse.nodered.org/t/how-to-pass-msg-path-msg-filename-to-file-in-node/38886/2 "2021-01-10T11:26:30Z")

</div>

Use a function node before the file in node.

```auto
msg.file = msg.filename;// save file name before overwriting (just in case)
msg.filename = msg.path + "/" + msg.filename;
return msg;

```

---

<div class="post-metadata">

**Author:** ![bird](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bird/32/34966_2.png) [@bird](https://discourse.nodered.org/u/bird)\
**Post date:** [10 January 2021 11:52 UTC](https://discourse.nodered.org/t/how-to-pass-msg-path-msg-filename-to-file-in-node/38886/3 "2021-01-10T11:52:08Z")

</div>

oh!!Right

thanks!!!!

---

<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:** [11 March 2021 11:52 UTC](https://discourse.nodered.org/t/how-to-pass-msg-path-msg-filename-to-file-in-node/38886/4 "2021-03-11T11:52:12Z")

</div>

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