Nov 12 2013

Print this Post

Automatically upload files to FTP server(s) using PowerShell

In the honor of taking a week off, I decided to share with you a script I’ve been asked to work on recently that automatically uploads a list of files to multiple FTP servers. Since I couldn’t find any native commands in PowerShell to work with FTP (Please leave comments if you know any), I decided to utilize the very handy “FTP.exe” that is built into windows. This tool can be used interactively from the command prompt, or accompanied with a script file with all the commands required.

The PowerShell script below basically reads data from a CSV files telling it the paths of each file to be uploaded, the FTP server (name or IP Address), username and password, and finally the path on the FTP server where the file should be sent to.

After the file paths are validated, the script will begin creating a “.s” file that is used at the end of the script to finally upload the data. Good guy FTP.exe also provides detailed log of the process which is all saved to a Log.log file for troubleshooting.

Here’s a flow chart of the logic of the script,

FTP Upload FlowChart

And below is the full script,


Finally for reference, this a sample CSV data to be used with the script, by default it looks for “.\UploadList.CSV” which should reside in the same folder as the PS1 file.


Hope you find the information useful.

About the author

Walid AlMoselhy

Permanent link to this article: http://almoselhy.azurewebsites.net/2013/11/automatically-upload-files-to-ftp-servers-using-powershell/


  1. mary

    I like the script, do you have one that downloads multiple files? I’m stuck on mine…

  2. Vikas Sukhija

    you can also use the below script that can upload files to ftp servers from a folder & than moved files to processed folder


Leave a Reply

Your email address will not be published. Required fields are marked *