# Best Method for moving files between Client and Server?

**URL:** <https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948>\
**Category:** Ignition\
**Tags:** python, ignition79, scripting\
**Created:** [July 24, 2018, 2:06pm UTC](https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948 "2018-07-24T14:06:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JLVanKeuren](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JLVanKeuren](https://forum.inductiveautomation.com/u/JLVanKeuren)\
**Post date:** [July 24, 2018, 2:06pm UTC](https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948/1 "2018-07-24T14:06:12Z")

</div>

Hello,

I’m currently working on developing a system with an edge client (on a windows tablet) which will be used by someone walking around a plant and documenting quality issues. Part of the documentation will include pictures which are taken using the tablet’s built in camera.

I then have a main ignition gateway which is reading tag values and saving them to a SQL database when prompted.

What I want to do is copy the image files from a shared folder on the tablet, to a folder on the machine running the Main Gateway/SQL database.

I’m aware that it is possible to store the image files in a tag as raw data, but for performance reasons I would prefer to avoid doing this.

Here’s what I’ve been testing in the script console without success:

import shutil

shutil.move("\JLV\_ROCKWELL\Users\jlv\Pictures\testfolder\file.jpg",“C:\Users\JLV\Desktop\copy target folder\file.jpg”)

Any help or guidance would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [July 24, 2018, 2:20pm UTC](https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948/2 "2018-07-24T14:20:30Z")

</div>

A single backslash will escape the next character. If you want to include backslashes in your paths then you will need to use a double backslash. After fixing that and verifying the paths, the next thing to check is permissions.

---

<div class="post-metadata">

**Author:** ![JLVanKeuren](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JLVanKeuren](https://forum.inductiveautomation.com/u/JLVanKeuren)\
**Post date:** [July 24, 2018, 2:23pm UTC](https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948/3 "2018-07-24T14:23:28Z")

</div>

Ah I will test that.

Before coming back to this, I tried mapping the file location as a drive on the main server/gateway, and it looks like it will actually find the file there. It seems like the main issues was trying to browse to a network location.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 24, 2018, 2:24pm UTC](https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948/4 "2018-07-24T14:24:18Z")

</div>

> [@JLVanKeuren](#):
>
> shutil.move("\JLV\_ROCKWELL\Users\jlv\Pictures\testfolder\file.jpg","C:\Users\JLV\Desktop\copy target folder\file.jpg")

Assuming JLV\_ROCKWELL is a hostname, you'll also need even more backslashes at the front. try:

```auto
shutil.move("\\\\JLV_ROCKWELL\\Users\\jlv\\Pictures\\testfolder\\file.jpg","C:\\Users\\JLV\\Desktop\\copy target folder\\file.jpg")

```

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [July 24, 2018, 2:31pm UTC](https://forum.inductiveautomation.com/t/best-method-for-moving-files-between-client-and-server/18948/5 "2018-07-24T14:31:31Z")

</div>

Another option would be to use a message handler to move the files, assuming the Ignition server is connected somehow to the file destination.

In a gateway scoped message handler:

```auto
	LOG = system.util.getLogger("filetransfer")
	b = payload["bytes"]
	f = payload["filename"]
	LOG.debug("filename:%s,length:%d"%(f,len(b)))
	system.file.writeFile("C:/files/%s"%f,b,False)

```

An example of some client code:

```auto
f = system.file.openFile(None)
if f:
	import os
	(dirname,filename) = os.path.split(f)
	bytes = system.file.readFileAsBytes(f)
	system.util.sendRequestAsync(project = "playground",messageHandler = "File Transfer",payload = {"filename":filename,"bytes":bytes})

```

Good luck!
