I’ve just created a new GotDotNet workspace for ftpsync,
the tool I’ve been writing this weekend when I should have been doing work.
But you know how it goes – you sit down to update your webpage, you get tired
of trying to figure out which files you’ve changed since the last upload, you
look around for a free tool that does incremental FTP upload, and you don’t
find anything free and good. So you write one yourself…we’ve all been
there, right?
It turned out reasonably well, given that I only worked on it for a few hours, so
I figure I’d throw it up on a workspace and see what happens. It needs better
error handling, and I’m not super-happy about the FTP library I’m using
(edtFTPnet),
which saved me a ton of time, but has an interface which is a bit clunky, and has
somewhat weird error handling. Of course, it works and it’s free, so I’m
not complaining too much.
Basic usage of the tool goes something like this:
ftpsync -s my.ftp.server.com -u myusername
-p mypassword -ld C:\local\directory -rd /initial/remote/directory
This would cause the program to upload via FTP anything that lives in C:\local\directory
that either
1. Isn’t
present on the FTP server, or
2. Is
present on the FTP server but is older that what’s in the local directory
You can add the -r switch to recurse directories, and the -rd switch to delete anything
on the remote server that isn’t on the present server. I also threw in support
for the ignore files (-if) and ignore directories (-id) switches. Oh, and a –debug
switch that spews tons of extra info.
Anyway, I’ve already had success integrating this into a Nant build that I run
to update this website, so I’m getting my money’s worth. It seems stable
enough, but if there are feature requests or bug reports, leave a note on the workspace…or
better yet, join and upgrade/fix it yourself ;) .
I wrote one of these a while ago. (Probably doesn't show up on google well...)
ReplyDeleteSlightly different requirements, but feel free to steal some code if you like.
http://www.eightypercent.net/Archive/2003/04/27.html
Joe
Thanks. I'll have to take a closer look at it at some point.
ReplyDeleteOooh, good deal. I have been there before, and wish this was around when I needed it :)
ReplyDeleteI intended to include source control awareness into my solution - so it could look into VSS/Vault and only compare files which have been changed recently (can't always depend on file system dates if you clear out your working directory everything has the same date) and also to perform a deployment based on a label.
I think this is defintely a niche area where tools could be written to make our lives easier...especially those living in strict configuration management environments (like where I current work).
Yeah, one of the problems I ran into was exactly that - the dates all get updated when you do a CVS checkout into an empty directory. My solution? Simply keep the directory around. The first time, it'll upload everything. After that, as long as you run the checkout with the flag that says, "Blow away anything in the local directory that isn't in the source repository" it works reasonably well. What would be better would be a switch that says, "Check out and set the file timestamp to the repository timestamp."
ReplyDelete