Firstly - YAFC? "What on earth is YAFC?" I hear you say. YAFC is a command line FTP tool which, unfortunately, only comes in source code which means you need to know how to compile it. Fortunately, compiling it is easy - it required very few dependencies and most of those I could install using yum on my linux box (Redhat Fedora).
The main reason I chose to use YAFC over something like the built in FTP client was due to its ability to recursively FTP contents. As part of my day job, I had to transfer an entire website from a shared host (with XCalibre) to our company dedicated server (hosted by Rackspace). Unfortunately, the shared server didn't allow shell access so there was no way I could make a compressed tarball of the site which would have made my life a lot easier. On top of this, the site was many levels deep with folders within folders within folders! This would have made FTP without recursion a nightmare. Transferring it in-house with a GUI client like FileZilla and then back out again would have taken hours due to the site's size… This is where YAFC stepped in!
YAFC - the shell friendly ftp client!
As the site was huge and the process was going to take a while, my first step was to use the screen command to open up a new 'virtual window'. Once the process was started I could detach this window (and even disconnect from the server altogether) and the process would continue to run in a detached screen which I could then re-attch at a later time by executing
screen -r (or, if there were multiple detached screen's, I could list them by
screen -list and then reattach using the ID from the list after the '-r' argument, eg
screen -r 8715).
Screen is one of the most useful linux commands I have found!
At this new screen, I connected to the server by issuing the command in this form (details have been changed for privacy reasons):
YAFC then connects to the server and authenticates (if necessary). I then executed the command
get -r * which tells YAFC to get all files and folders recursively off the remote server. You can replace get with put if you want to upload rather than download.
Once this was going - I pressed Ctrl and A together, then the d key on its own - this is the keyboard combination to detach a screen. I then clossed the Putty window and got on with some other work for an hour or so. I logged back in later on and retrieved the screen using the above retrieval code (
screen -r) and the entire site had transferred across flawlessly.
Today I have also found out (from the YAFC mailing list archive) that you can pass a text file with command in it to YAFC to execute. This is not an intentional feature, according to the author of this program, however it seems to work!
I used YAFC's bookmarking feature to store the login details to my backup server and now I can (in theory) use cron to automatically run YAFC to transfer my locally backed up files onto the remote server!
YAFC is one hell of a good (and lightweight) FTP Client and I'm glad I installed it.