關於我

我的相片

在此提供一些有關你的資訊,以便其他人確認你是他們要找的Fai。

2008/03/15

Mirroring ftp site with lftp

XEPC.org has down due to data center power supply, I found that I need to find one more place to backup my XEPC.org software repository.
I applied a project on www.tuxfamily.org and it has been approved.
But there is one difficult, it only support ftp upload, not rsync, so how can I do synchronization between my local mirror and tuxfamily mirror?
I tried gftp to upload, but as it is GUI tool, I cannot run it remotely on office machine (which is the local mirror). After researching, I found lftp has a mirror operation, which works very closed to rsync, the lftp mirror operation manual.



mirror [options] [remotedir [localdir] ]
Copy a directory exactly. The mirror command accepts the following arguments:
-c, --continue
If mirroring was interrupted, resume it.
-e, --delete
Delete local files that are not present at the remote site.
-R, --reverse
Mirror files from the local system to the remote system. With this argument, make sure that you specify the local directory first and the remote directory second. If you do not specify both directories, the second is assumed to be the same as the first. If you choose neither, the operation occurs in the current working directories.
-L, --dereference
When mirroring a link, download the file the link points to rather than just the link.
-i, --include regex
Get only the files whose names match the regular expression regex. See grep for more information about regular expressions.
-x, --exclude regex
Do not get the files whose names match regex. See grep for more information about regular expressions.
-v, --verbose=n
Set the verbose level. You can set n from 0 (no output) to 3 (full output) using a number or by repeating the v. For example, -vvv is level 3 verbose mode.
--remove-source-files
Move, rather than copy, files when mirroring.