1

Trying to set up a post build script on my CI server to push changes to our web server by FTP. In as few lines as possible how can i push a folder of files to my webserver using windows FTP? For example deployment folder is:

c:\deployment\*.*

How can i recursively push all files to replace on the web server?

I'm open to using cmd or powershell - MS Windows only

Thanks

atp03
  • 3,539
  • 3
  • 17
  • 20
  • Why does it have to be "in as few lines as possible" if it's a script? LOC should not matter much - what counts is the *results*. I much prefer a longer, slightly more verbose script that's easily understood by anyone picking it up vs. 2 densely-packed lines full of arcane commands which require reading additional documentation to understand. – alroc Feb 01 '13 at 15:37
  • See [this SO thread](http://stackoverflow.com/questions/1867385/upload-files-with-ftp-using-powershell) asking for the same thing in PowerShell. – alroc Feb 01 '13 at 15:43

2 Answers2

4

Windows' built-in command-line FTP client doesn't have recursion built-in. The easiest way would be to use a different FTP client. NcFTP will do what you're looking for. See the manual page for ncftpput. The syntax is basically as follows:

cd c:\deployment
ncftpput -u user -p pass -R ftp.ftpserver.com /path/on/ftp/server .\*

Or if your web server also runs an ssh service, then rsync would be even better.

rojo
  • 24,000
  • 5
  • 55
  • 101
0

Fsync is good, I am using it for long. It allows to push only what has changed. Recursion of course. Exclude files, too. Track client-side (much faster) what has changed... Biggest only drawback: No SFTP./ProductList/Fsync.html

Frank N
  • 9,625
  • 4
  • 80
  • 110