# system.file.writeFile() and 'Unable to create path to file'

**URL:** <https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656>\
**Category:** Ignition\
**Created:** [June 28, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656 "2023-06-28T15:34:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [June 28, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656/1 "2023-06-28T15:34:30Z")

</div>

Looking for a bit of a sanity check. Having a file export of the data on the hour for another system to pull in for a customer. It seems to work fine for the first few exports, then all of a sudden it will stop and just put errors in the logs saying 'Unable to create path to file'. I do have the network share mapped in the conf file. I've been exporting local copies as a fall back, but would like to find the root cause.

Is there anything I'm missing on the Ignition side? Or is this likely going to be permissions on the network share itself most likely?

Edit: If communication to the network drive was lost intermittently, would Ignition try and reconnect automatically? Or would a restart have to occur to reconnect?

---

<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:** [June 28, 2023, 3:39pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656/2 "2023-06-28T15:39:18Z")

</div>

> [@grietveld](#):
>
> I do have the network share mapped in the conf file.

Yeah, this isn't very reliable. Consider running the Ignition service under a domain account that has privileges on the target file server, then use UNC paths instead of drive letters. But include some timer event that will try to save again later if that fails.

Even better would be to save locally in the gateway, and expose a WebDev endpoint that the external system could use to retrieve the last saved version. (Or generate on the spot--no file saved at all.)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [June 28, 2023, 3:44pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656/3 "2023-06-28T15:44:19Z")

</div>

Just regarding the .conf file methodology it tries to connect when the gateway starts up but if the connection is lost while the GW is running it will not retry and as far as I can tell (I asked if there was a way to retry programatically via a GW script) it does not seem like there is a way.

> [@How to force the Gateway to map drives when there is a failed attempt at restart](https://forum.inductiveautomation.com/t/how-to-force-the-gateway-to-map-drives-when-there-is-a-failed-attempt-at-restart/65929):
>
> This week-end the Ignition Gateway server rebooted after windows updates. At reboot, the gateway failed to map a drive to a remote server (maybe because it was rebooting too) Is there a way to force the gateway to try remap the drive manually without restarting the entire gateway ?

Highly recommend using one of the other options Phil listed instead of trying to make the .conf login method be more robust - doesn't seem possible.

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [June 28, 2023, 3:50pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656/4 "2023-06-28T15:50:59Z")

</div>

> [@bkarabinchak.psi](#):
>
> Just regarding the .conf file methodology it tries to connect when the gateway starts up but if the connection is lost while the GW is running it will not retry and as far as I can tell (I asked if there was a way to retry programatically via a GW script) it does not seem like there is a way.

Yeah that scenario clicked in my brain right after hitting send. They have some intermittent network issues in that facility, so think that could be our culprit and its just never reconnecting without intervention.

I'll give Phil's solution a shot. Sounds like it should get me there.

---

<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:** [June 28, 2023, 4:03pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-and-unable-to-create-path-to-file/75656/5 "2023-06-28T16:03:36Z")

</div>

If you don't have the WebDev module, another option would be to stick the file bytes into your database as a blob, then hand it to external callers with my Blob Server module.
