# Switch filname for data

**URL:** <https://discourse.nodered.org/t/switch-filname-for-data/59304>\
**Category:** General\
**Created:** [3 March 2022 12:29 UTC](https://discourse.nodered.org/t/switch-filname-for-data/59304 "2022-03-03T12:29:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mersaia](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mersaia](https://discourse.nodered.org/u/Mersaia)\
**Post date:** [3 March 2022 12:29 UTC](https://discourse.nodered.org/t/switch-filname-for-data/59304/1 "2022-03-03T12:29:21Z")

</div>

Hallo together,

```auto
//Dateinamen zum speichern generieren
msg.fname = "Charge_" + yyyy + mm + dd + ".csv";
//Pfadangabe + Filename
msg.filename = "M:/folder1/folder2"+ msg.fname;

```

my problem is that i get an error with that hard drive M:  
i dont wanna save datas to my ssd hard drive.

Can someone give me a tip how i can switch harddrive for only this flow?

Spazial Thanks

---

<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:** [3 March 2022 13:19 UTC](https://discourse.nodered.org/t/switch-filname-for-data/59304/2 "2022-03-03T13:19:39Z")

</div>

I think you will need to give more information about what you want to do. If you don't want to use `M:` then can you not just change it to whatever drive you want?

---

<div class="post-metadata">

**Author:** ![Mersaia](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mersaia](https://discourse.nodered.org/u/Mersaia)\
**Post date:** [3 March 2022 13:27 UTC](https://discourse.nodered.org/t/switch-filname-for-data/59304/3 "2022-03-03T13:27:57Z")

</div>

This code is not working i got a debugging fault:

"failed to create file: Error: Path contains invalid characters: /M:/folder1"

If i dont use hard drive in flilename it works perfect.

---

<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:** [3 March 2022 13:36 UTC](https://discourse.nodered.org/t/switch-filname-for-data/59304/4 "2022-03-03T13:36:23Z")

</div>

Add a debug node set to Output Complete Message showing what is coming out of your function node. Also tell us what happens to the message. If it goes to a File node then show us how you have configured the file node.

---

<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:** [2 May 2022 13:36 UTC](https://discourse.nodered.org/t/switch-filname-for-data/59304/5 "2022-05-02T13:36:29Z")

</div>

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