Mirror TWiki Attachments


mirror-twiki-attachments - mirror attachments of a TWiki web


mirror-twiki-attachments [--help] [--passwd_file passwordfile] [--twiki http://host/path/twiki] [--verbose] [--web web name]


mirror-twiki-attachments visits the specified TWiki web and stores all attachments of all topics in the current, local directory. The script tries to be friendly on the server by first requesting an index page of the topics in the target web and comparing the change dates listed on that page with the last known change dates stored in the file topicchangedates.txt. Then, it visits the attachment tables of the updated or new topics and constructs a list of attachments which are to be mirrored. Afterwards, it mirrors them (i.e. it downloads them if they are newer than a local copy, if available). Note that this procedure applies to (and is of interest to) TWiki configurations which do not have the /pub directory browsable.

For the first-time mirroring of a directory, create a new directory and create an empty topicchangedates.txt file in it.

Options may be specified on command-line and given in the configuration file .mirror-twiki-attachments.conf in the current directory; one option per line, option arguments introduced by an equality sign.


Print (this) help on options.
--passwd_file passwordfile
Use the passwordfile for authentication information; the file format of that file is the same as for the w3m browser.
Download only RCS files on the TWiki server. Note: RCS files may get very big, especially for binary files with many versions.
Download the RCS files on the TWiki server as well. Note: RCS files may get very big, especially for binary files with many versions.
--twiki http://host/path/twiki
The URL of the TWiki server.
Be more verbose while mirroring.
--web web name
The name of the web to mirror.


The file format of the password file is compatible with that of the w3m browser. An example of a host entry in that file is given here:

  host www.twiki-host.domain
  port 443
  realm Enter your WikiName:
    (First name and last name; no space; no dots; capitalized; e.g. JohnSmith).
    Cancel to register if you do not have one.
  login WikiName
  password seCRet

The port defaults to 80 if not given. The line with the realm option has been split for readibility; it must appear as a single line in the password file.

Bugs and Caveats

For SSL access, IO::Socket::SSL or a similar package has to be installed.

Standard directory layout of the TWiki is assumed.

Local deletion of directories won't be detected until topic is updated

Topic dates are updated even if mirroring failed.

A directory for a topic is created even if this topic has no attachment.

Local deletion of a topic will not be detected until the topic is updated on the server.

Attachments that are deleted or moved in the TWiki web are not deleted locally but rather renamed adding a tilde suffix. Also, deleted topics are only reported but not deleted locally. Thus, real deletion has to be done manually (e.g., to delete all backup files, you may execute find . -name "*~" -print0 | xargs -0 rm).


(C) 2004-2005 Mark Hillebrand .

This code is released under the BSD License. Before using this software, visit http://www.opensource.org/licenses/bsd-license.php for the full license text.

See Also

w3m, http://twiki.org/


Page MirrorTWikiAttachments
Revision 03 May 2005
Parents: Index