I needed to download all the files in a robot controller in order to back up them into a server.
That robot controller offered only FTP connection to get access to those files.
From a Windows 7 computer, I needed to automate the download of all those files.
The FTP tools that come preinstalled with Windows are easy to use, but don't offer any option to recursively download files.
In order to be able to do that, you should create a script that would list the files and folders and then process them all.
- Download files from the Internet
- Know usernames and passwords from the FTP server
- Basic file editing
Using the Code
The first step is to download the wget tool from its site: http://gnuwin32.sourceforge.net/packages/wget.htm
Once you have the tool in your computer, you'll have to write a batch file with those contents:
c:\"program files (x86)"\GnuWin32\bin\wget
--recursive ftp://IP_ADDRESS_OF_YOUR_SERVER/ --directory-prefix="DESTINATION_PATH"
The path to the wget executable is given at the beginning.
The user name and password are given using the
--recursive parameter activates the ability to go deep up to 5 levels (unless you specify something different).
Then you specify your FTP server address, using the IP address or the name of the computer, and finally, you specify the folder where you want the files to be downloaded.
This small tip is a very simple thing, but can help many people who need to perform this kind of automation and to myself to remember what I did.
- 15th May, 2019: Initial version