# Access a network drive

**URL:** <https://forum.inductiveautomation.com/t/access-a-network-drive/54410>\
**Category:** Ignition\
**Created:** [December 22, 2021, 9:00pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410 "2021-12-22T21:00:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [December 22, 2021, 9:00pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/1 "2021-12-22T21:00:51Z")

</div>

Hello all,

I would like to be able to pull out all the file names from a folder on my computer (windows) and then put them into a python list, cannot find a way to do that and would appreciate it if you could help me in this regard. Thank you!

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [December 22, 2021, 9:16pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/2 "2021-12-22T21:16:29Z")

</div>

Assuming that the computer where your files exist is the same machine that your Ignition gateway is located on, you could do this with the python os library:

```auto
import os
folder = 'C:/Path/To/Folder'
fileList = os.listdir(folder)

```

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [December 23, 2021, 2:16pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/3 "2021-12-23T14:16:59Z")

</div>

Thank you very much @swolnisty. Appreciate your help! This works when I have a local drive folder but not for the network drive.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [December 23, 2021, 2:55pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/4 "2021-12-23T14:55:19Z")

</div>

What if the folder is sitting inside the network? This script does not work for that.

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

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [December 23, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/5 "2021-12-23T15:00:12Z")

</div>

Does _Ignition_ have read rights to that folder?

[https://docs.inductiveautomation.com/display/DOC81/Mapping+a+Network+Drive](https://docs.inductiveautomation.com/display/DOC81/Mapping+a+Network+Drive)

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 23, 2021, 3:04pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/6 "2021-12-23T15:04:56Z")

</div>

You will have to create a mapping of it. So that it appears under your devices/drives instead of under network.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/0/109bce0a385c929434d338f2f950bac980b839f0.png)  
And seems you need to put in some configs too as @Matrix_Engineering linked

---

<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:** [December 23, 2021, 3:15pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/7 "2021-12-23T15:15:11Z")

</div>

> [@victordcq](#):
>
> You will have to create a mapping of it

Look closer at Parya's screenshot for the "F:". The Ignition gateway runs as a service and has no access to any desktop user's mappings. Mappings must be established in the service.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [December 23, 2021, 4:31pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/8 "2021-12-23T16:31:55Z")

</div>

I’m not super familiar with windows, how do you see that ?

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [December 23, 2021, 4:35pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/9 "2021-12-23T16:35:06Z")

</div>

To whom are you replying to sorry?

The Ignition service can have a map linked as per the documentation link I posted (edit the ignition.conf file).

We can see that Parya’s link is a network location as per their screenshot with the red circled item.

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [December 23, 2021, 4:47pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/10 "2021-12-23T16:47:35Z")

</div>

I have done this as well, though I have accomplished this in kind of a strange way. See my reply to the thread below:

> [@How to Access network drive folder in perspective](https://forum.inductiveautomation.com/t/how-to-access-network-drive-folder-in-perspective/52487/11):
>
> I have done something similar to this, though I would caution that I was told the method I used is not officially supported by Inductive Automation and there’s no guarantee that this would work in future versions of the software. You can reference directories and files contained within the /webserver/webapps/main directory of your Ignition install directly from a web browser by simply appending the file name to the address of your Ignition gateway. For example, if you placed an mp3 file named ‘…

In this case, rather than accessing the files from the webserver/webapps/main directory, you would just be checking the contents with the os.listdir() function I mentioned in my previous post.

Edit: I guess there's no real reason why you'd need to create a symbolic link within the Ignition install directory, you could create it anywhere on the gateway machine.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [December 25, 2021, 6:14am UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/11 "2021-12-25T06:14:18Z")

</div>

deleted

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [January 6, 2022, 1:41pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/12 "2022-01-06T13:41:58Z")

</div>

I changed the config file but I get an error.

```auto
org.python.core.PyException
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
caused by IllegalArgumentException: Cannot create PyString with non-byte value

```

Here is what I did:  
In the config file, I added:

```auto
wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

wrapper.ntservice.account=username
wrapper.ntservice.password=pass
wrapper.share.1.account=domain\username
wrapper.share.1.password=pass

```

Then stop/start the gateway and I used the script below for my button:

```auto
	import os
	folder = "\\fileserver\Automation\..."
	fileList = os.listdir(folder)
	self.getSibling("TextArea").props.text=fileList

```

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 6, 2022, 1:54pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/13 "2022-01-06T13:54:51Z")

</div>

> [@pkhoshroo](#):
>
> `wrapper.share.1.location="\\fileserver\Automation\..."`

You don't put quotes into the conf for a file path, and also no 3 dots, for the full folder it is:

```auto
wrapper.share.1.location=\\fileserver\Automation\

```

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [January 6, 2022, 2:01pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/14 "2022-01-06T14:01:25Z")

</div>

I just did that for the demonstration only. I put the actual full path there, also since the location path has spaces, I need to wrap the value in double quotes

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 6, 2022, 2:08pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/16 "2022-01-06T14:08:43Z")

</div>

> [@pkhoshroo](#):
>
> ```auto
> import os
> folder = "\\fileserver\Automation\..."
> fileList = os.listdir(folder)
> self.getSibling("TextArea").props.text=fileList
> 
> ```

Try:

```auto
        import os
	folder = "D:\"
	fileList = os.listdir(folder)
	self.getSibling("TextArea").props.text=fileList

```

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [January 6, 2022, 2:23pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/17 "2022-01-06T14:23:03Z")

</div>

When I write the script below in the config file:

```auto
wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

```

It means that I should be able to see that folder in my D drive, correct? If this is the case, I do not see any new folder that has been added to my D drive.

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 6, 2022, 2:25pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/18 "2022-01-06T14:25:01Z")

</div>

No, you are telling Ignition service that if a script looks for contents of D:\ then is it as \fileserver\Automation\

It does not create a windows mapped drive

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 6, 2022, 2:27pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/19 "2022-01-06T14:27:17Z")

</div>

Just for clarity, the share location should be an already existing folder and the target is the alias by which Ignition accesses that folder.

---

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [January 6, 2022, 2:35pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/20 "2022-01-06T14:35:58Z")

</div>

So as an example:

If I have a folder in my network drive with some images in it like:

`\\fileserver\Automation\MES Ignition for program\sample Image`

When I write this:

```auto
wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

```

I need to have a folder set up with the same images and folder path in my D drive too? It is a bit confusing what needs to be done. Let’s say now I have a new folder in my D drive, then do I need to change the script below?

```auto
wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

```

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 6, 2022, 2:41pm UTC](https://forum.inductiveautomation.com/t/access-a-network-drive/54410/21 "2022-01-06T14:41:13Z")

</div>

> [@pkhoshroo](#):
>
> `wrapper.share.1.location="\\fileserver\Automation\..."`

This does nothing.

```auto
wrapper.share.1.location="\\fileserver\Automation\"

```

will grant access to:

```auto
\\fileserver\Automation\MES Ignition for program\sample Image.jpg

```

If you already have a mapped drive called D on your server, is it the one that has the Automation folder that you want Ignition access to?

[Next page](https://forum.inductiveautomation.com/t/access-a-network-drive/54410.md?page=2)
