# Create filepath string

**URL:** <https://forum.inductiveautomation.com/t/create-filepath-string/56859>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [March 4, 2022, 6:56pm UTC](https://forum.inductiveautomation.com/t/create-filepath-string/56859 "2022-03-04T18:56:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [March 4, 2022, 6:56pm UTC](https://forum.inductiveautomation.com/t/create-filepath-string/56859/1 "2022-03-04T18:56:10Z")

</div>

I am trying to create a simple filepath. I want to add one variable in the middle of the filepath. To test I created a simple button which reads a value in, then I try to create the full filepath, and then write that filepath to a tag to confirm its coming out right. I get the following errors though.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/e/ce0a47b1be569ea5b472ee36a5b056fd37ee9bd7.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/8/58265d509d2434be57397c272cbc18c54ec9d2d9.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 4, 2022, 7:03pm UTC](https://forum.inductiveautomation.com/t/create-filepath-string/56859/2 "2022-03-04T19:03:43Z")

</div>

You haven’t escaped your backslashes. Backslashes mark control codes in virtually every programming language on the planet. If you want a real backslash in a language’s quoted string, you need two of them.

(In python, triple quoted strings and the `r'some\raw\string\with\backslashes'` construct are exceptions.)

Your error message is especially cryptic because you put a backslash before a quote, making that quote _ **part of the string** _ instead of ending the string. Look at the color coding in your screenshot.

---

<div class="post-metadata">

**Author:** ![michael.black](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael.black](https://forum.inductiveautomation.com/u/michael.black)\
**Post date:** [March 4, 2022, 7:09pm UTC](https://forum.inductiveautomation.com/t/create-filepath-string/56859/3 "2022-03-04T19:09:30Z")

</div>

Thanks! I still don’t get why I see other code that is written with only one backslash and it works. Anyways I put double slashes and got the following…

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8ab584330c244b1436c53a3e0e218f3facb8536c.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/1/718b8db64308d29234b3b46bfc125a7b70a44bf5.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 4, 2022, 7:12pm UTC](https://forum.inductiveautomation.com/t/create-filepath-string/56859/4 "2022-03-04T19:12:36Z")

</div>

Because only certain escape sequences are valid. If the character following the backslash is a valid escape, it gets converted. If not, the backslash is left in place. Random crapshoot unless you know the escaping rules by heart.

In many places in python/jython/java, you can just use forward slashes as your directory separator and it will be translated to the OS format on your behalf. Try that.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 4, 2022, 9:35pm UTC](https://forum.inductiveautomation.com/t/create-filepath-string/56859/5 "2022-03-04T21:35:10Z")

</div>

> [@pturmel](#):
>
> In many places in python/jython/java, you can just use forward slashes as your directory separator and it will be translated to the OS format on your behalf. Try that.

Definitely what I would recommend.
