# FTP Client Speed via Scripting

**URL:** <https://forum.inductiveautomation.com/t/ftp-client-speed-via-scripting/26620>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [July 17, 2019, 12:58pm UTC](https://forum.inductiveautomation.com/t/ftp-client-speed-via-scripting/26620 "2019-07-17T12:58:10Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![r.huisken](https://avatars.discourse-cdn.com/v4/letter/r/47e85d/32.png) [@r.huisken](https://forum.inductiveautomation.com/u/r.huisken)\
**Post date:** [July 18, 2019, 11:27pm UTC](https://forum.inductiveautomation.com/t/ftp-client-speed-via-scripting/26620/7 "2019-07-18T23:27:58Z")

</div>

Thank you for the suggestions. Using PGriffith’s suggestion I was able to use the java libraries and reduce the time to download a batch of files from 4.5 minutes to 11.5 seconds. For anyone use who is curious, here’s a chunk of what I came up with:

```auto
import os
from java.net import URL
from java.net import URLConnection
from java.io import BufferedReader
from java.io import InputStream
from java.io import InputStreamReader

def getInputStream(robotController, path):
	ftpUrl = "ftp://%s:%s@%s/%s" % (robotController[2], robotController[3], robotController[1], path)
	url = URL(ftpUrl)
	urlConnection = url.openConnection()
	inputStream = urlConnection.getInputStream()
	return inputStream

def downloadFile(robotController, fileName, folder):
	inputStream = getInputStream(robotController, fileName)
	
	streamReader = InputStreamReader(inputStream)
	reader = BufferedReader(streamReader)
	
	fileData = []
	line = reader.readLine()
	while line != None:
		fileData.append(line)
		line = reader.readLine()
	inputStream.close()
	
	saveFilePath = os.path.join(folder, fileName)
	try:
		file = open(saveFilePath, 'w')
		for line in fileData:
			file.write("%s\n" % (line))
		file.close()
	except Exception, ex:
		writeMessage("Error writing %s : %s" % (fileName, str(ex)))

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/ftp-client-speed-via-scripting/26620)._
