|
FTP Sync for Web Developers |
Billybob
Member #3,136
January 2003
|
As a web developer I find trying to sync the local copy of my website with the remote copy to be quite painful. If I change files in two different directories I then have to go to my FTP client, switch directories, switch remote directory, upload, switch, switch, upload. I have always wanted a way to just hit "Sync" and have everything uploaded for me. So today I made the tool myself. I wrote it in Java, so I guess it'd work on any machine, for you Linux Web Developers The tool keeps track of files locally, to determine if they change, and does not use the remote FTP server as a reference. This is because trying to sync with the timestamps on the FTP server is far too difficult. The tool is not complete. Things to do:
Here's the code:
Explanation: If you find it useful then that's great, but I don't really care because I'll keep working on it no matter what ... I need it.
|
Matthew Leverton
Supreme Loser
January 1999
|
It's a common problem, so you are probably doing a lot of wheel re-inventing. I use WinSCP for transferring files because: 1) it's secure and 2) it has a lot of syncing tools built in (like synchronized browsing). Also there is rsync, which is very nice for keeping two locations identical. |
Thomas Fjellstrom
Member #476
June 2000
|
And neither work all that well if all you have is ftp. -- |
gnolam
Member #2,030
March 2002
|
Quote: It's a common problem, so you are probably doing a lot of wheel re-inventing. I use WinSCP for transferring files because: 1) it's secure and 2) it has a lot of syncing tools built in (like synchronized browsing). It also has a Norton Commander-like interface, which is always a good thing. -- |
Carrus85
Member #2,633
August 2002
|
Well, it looks nice, but I can see some potential optimizations. For example, you could use the java.util.TreeSet (or HashSet) to cache the results from the FTP server once instead of running through the list multiple times in your findFile function. Additionally, you should technically put your stream.close() statements inside of a finally block, otherwise they won't get called upon an exception being thrown. Looking good though
|
kazzmir
Member #1,786
December 2001
|
I wrote a ruby program to do exactly this. Its pure CLI and suits my needs. Check it out if you want: |
|