2

I'm looking for a batch script to automate the upload of MULTIPLE files at a time to an external ftps site (ftps://servername.xxxx.com).The files are located in a folder on a Windows Server 2008 system.If possible the batch script also needs to check if the files don't already exist in the remote folder to avoid overwrite. Many thanks.

ciscokid
  • 53
  • 3
  • 7

3 Answers3

3

WinSCP has a batch/script interface. The synchronize command appears to do what you want.

Martin Prikryl
  • 7,327
  • 2
  • 36
  • 71
afrazier
  • 710
  • 4
  • 7
  • Last time I checked, this was only a feature you got if you paid the $30 for the software. Is this not true anymore? – djangofan Jun 20 '11 at 16:12
  • @djangofan It used to cost money? – TheLQ Jun 20 '11 at 16:14
  • I'm looking for a batch script without the need for installing extra software on the server itself. – ciscokid Jun 20 '11 at 16:51
  • @djangofan: When has WinSCP ever cost money? – afrazier Jun 20 '11 at 17:00
  • @ciscokid: That's probably impossible, since there's no FTPS client built into Windows AFAIK. WinSCP at least has a portable version, so that no data need be stored outside of the program folder. A VBS/PS wizard might be able to put something together (assuming there's any FTPS client functionality built into Windows at all), but it'd be a lot of work, particularly to get the "avoid overwrite" bit in place and working correctly. – afrazier Jun 20 '11 at 17:02
  • @afrazier - I am a Bitwise SSHD user, but last time I used WinSCP, it was all free EXCEPT that if you wanted the synchronize feature (the feature everyone wants) , then you had to fork over money. Yes, it does appear that it is no longer the case and its totally free. – djangofan Jun 20 '11 at 22:34
  • @djangofan: When was the last time you used WinSCP? The oldest reference I can find on archive.org is Feb 2005, and it was open source back then. OldApps.com indicates that Version 2.0 was released in 2002 and was free then too. The comparo w/ Bitvise is particularly confusing since it's an SSH *server*, while WinSCP is an SFTP *client*. – afrazier Jun 21 '11 at 01:24
  • @afrazier - When i tried it, was around 2008-2009 time frame. I am nearly certain that , at that time, WinSCP "appeared" totally free except for the sync feature. – djangofan Jun 23 '11 at 18:24
0

I would write yourself a small (less than 50 line) Java program using Apache Commmons Net utilities and then start that process in your batch file. This is the way I do it, although I currently do it via HTTPS protocol, FTPS should be doable without too much of a problem.

If it helps, and you need a rough example of this KIND of thing, I posted a blog post with my code at: http://djangofan.blogsite.org/wordpress/?p=12

djangofan
  • 4,172
  • 10
  • 45
  • 59
  • Even as a Java programmer myself, that seems a little heavy and time consuming. – TheLQ Jun 20 '11 at 16:15
  • Indeed. Can anyone provide me with a 'simple' script that does the job as described above. If not possible without additional software, like afrazier stated, a script that can be launched through a batch file would also do. – ciscokid Jun 20 '11 at 17:15
  • I thought it was too ridiculous to post a giant section of code. I don't have an exact example. If you want code for my HTTPS example, I posted a link (above). You'll have to modify the example to work with FTPS. Not sure how hard that would be. – djangofan Jun 20 '11 at 22:28
0

The easiest and most reliable way to do this on Windows is with a commercial automated FTP tool like Robo-FTP (https://www.robo-ftp.com).

FTPLOGON "mysite"
SENDFILE "*" /ifnewer
FTPLOGOFF

That would upload all files, skipping any files that already exist on the server and are not newer than the local copy.