# Exec node with dynamic filename

**URL:** <https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887>\
**Category:** General\
**Created:** [2 December 2020 17:12 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887 "2020-12-02T17:12:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![landersson936](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@landersson936](https://discourse.nodered.org/u/landersson936)\
**Post date:** [2 December 2020 17:12 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887/1 "2020-12-02T17:12:10Z")

</div>

I can copy a file fine using the copy command in the Exec node, but is there a way the filenames could be based on a payload variable?

---

<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:** [2 December 2020 20:04 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887/2 "2020-12-02T20:04:36Z")

</div>

Yes.

Also, you might want to look at [node-red-contrib-fs-ops](https://flows.nodered.org/node/node-red-contrib-fs-ops)

---

<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:** [2 December 2020 21:39 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887/3 "2020-12-02T21:39:15Z")

</div>

If you still want to use the exec node then it can be passed the complete command (so you can build that up before passing it to the exec node) by leaving the Command field empty and selecting Append Payload. Alternatively, where appropriate, you can put the bulk of the command in the node and then just pass parameters in the payload, again with Append selected.

---

<div class="post-metadata">

**Author:** ![landersson936](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@landersson936](https://discourse.nodered.org/u/landersson936)\
**Post date:** [3 December 2020 13:37 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887/4 "2020-12-03T13:37:46Z")

</div>

Can you show me an example of that?

---

<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:** [3 December 2020 14:02 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887/5 "2020-12-03T14:02:08Z")

</div>

With fs-ops

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e06fffcdb63ccbf8eac830924de616bd61e310f5.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c61d709f9477cf40ce038508d273acea0f5d491.png)

---

<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:** [1 February 2021 14:02 UTC](https://discourse.nodered.org/t/exec-node-with-dynamic-filename/36887/6 "2021-02-01T14:02:14Z")

</div>

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