Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got a set of tools which periodically (about once a day) generate a complete set of static HTML pages for a site with associated folder structure etc.

I then need to put those file onto the production server, my problem is that the server runs IIS(6 I think) and I only have regular FTP access.

I need a way to automate the process of publishing the new site and it needs to a total replacement of the files each time its published, eg delete the whole folder & contents then put the new ones up.

My source server is a ubuntu machine and I've got total control at that end, I have tried using CurlFTpFS but it seems to be too slow for what I'm trying to do and locks up.

share|improve this question

6 Answers 6

Write a script. You might find Expect suitable, which has less of a learning curve for some people. I typically do something like this to redirect input in bash:

ftp HOST<<_EOF
USER
PASSWORD
ls
_EOF

Expect

share|improve this answer
    
That was the sort of thing I was thinking, I just can't figure out how to remove all the old files first. –  user39099 Mar 29 '10 at 13:58
    
delete and mdelete. Read the manpage for the ftp client. –  Warner Mar 29 '10 at 14:03

Use rsync if you can. Rsync allows you to generate diff files that show what has changed, what exists on the target but not in the source, etc. It will make this kind of task much easier.

There are several repackagings of rsync for Windows.

share|improve this answer

I would checkout FUSE with ftpfs, this way you could simply mount the external Server via ftpfs and work with it like a regular Filesystem, so just write a script to update the whole page. I'm using FUSE with ftpfs on my Mac and it performs quite well there, so I guess Linux shouldn't be much of a difference.

share|improve this answer
    
This seems like it would be more fallible that most solutions. –  Warner Mar 29 '10 at 13:26
    
I;ve tried ftpfs but its far too slow and seems to timeout. Think I may need an FTP script of some sort was hoping someone might have one. –  user39099 Mar 29 '10 at 13:32
    
as a sidenote, from a windows7 perspective this is how i would do it, by mapping a drive with FTP protocol... –  djangofan Apr 7 '10 at 0:17

cwrsync is a port of rsync for Windows - Easy to install if you have admin access (it sounds like you may not). Alternatively have your host set up rsync on the server to PULL from your Ubuntu box if possible. If neither is possible perhaps look for a more flexible host to meet your needs.

The fuse based ftp, and/or scripts, are going to be MUCH harder unless you have a very small set of files - You're likely to time out, have partial uploads, etc. rsync is VERY simple and really designed to manage this type of challenge.

share|improve this answer

Yuu could use the Kermit FTP client, which has its own scripting language/syntax for automating FTP uploads. Seems finicky, but looks like it should be able to do the trick

http://www.columbia.edu/kermit/ftpclient.html

share|improve this answer

Try lftp ; it's scriptable and etc, and supports commands like 'mrm' (multi-remove) and 'mput' (multi-put) that should be helpful. And it's packaged etc for ubuntu, so

aptitude install lftp

will let you try it out easily.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.