View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Felix von Leitner > Mirror-1.0 > mirror


Annotate this POD

View/Report Bugs


mirror - Simple FTP mirror program


  mirror [--from URL] [--to directory] [--skip regex] [--maxsize integer]
         [--norecurse] [--passive] [--verbose] [--deleteold]
         [--simulation] [--donttrymdtm] [--dashe]
         [--db filename]


This program can be used to mirror parts of FTP servers to a local directory. These are the meanings of the options:

--from <URL>

Where to mirror from. This has to be an FTP url. This can be a directory or an expression, where mirror allows simple globbing. Valid expressions are,[cd][cb],|db)/,|db)/g(cc|db)*.tar.gz.

--to <directory>

Where to put the mirrored files. If this does not start with a dot or a slash, it is assumed to be meant relative to the home of the user ftp. So maybe you could use pub/gnu meaning ~ftp/pub/gnu.

--skip <regex>

Files matching this regular expression are not mirrored.

--maxsize <integer>

Files greater that this are not mirrored.


If you don't want mirror to descend all subdirectories, use this option.


Use passive FTP.


Output tons of debug information. Maybe this should be renamed to --debug.


If you enable this option, mirror will try not to mirror old versions. Old versions that are replaced with newer version are also deleted. This applies only to the major version, several versions with the same major version can coexist. Everything behind "pl", "b", "-beta", etc. is not part of the major version. Please note that using this option is dangerous as it considers "gcc-2.7.1-2.7.2-diff.gz" as version "2.7.1" and will thus delete it if "gcc-2.7.2.tar.gz" is there. So you might need an extra mirror to get the newest diffs, too.


This option makes mirror run a simulation. Everything will look like mirror actually mirrored something, but it will just write out what it would have mirrored, symlinked or deleted.


MDTM is the FTP command to get the modificaton time of a file. Mirror will normally try to use MDTM on all remote files to get the exact modification times. Some old FTP servers do not support this option. Mirror will detect this and try to get the time from the directory listing. But trying MDTM costs time, and you might want to tell mirror with this option that it should not even try to use MDTM.


This experimental option could be used to get the exact time, too. GNU ls has a "-le" option, which prints the date in the form "Sat Sep 21 03:01:44 1996" instead of "Sep 21 03:01", so mirror can find out the seconds, too. Unfortunately it is quite unlikely that someone with an FTP server that does not support MDTM uses a recent GNU ls on his FTP server, so this option is off by default. Since parsing the normal "ls" output seems to work fine, I haven't really used this option. Take care!


Keep a database with the files that were already mirrored. This is useful because mirror won't mirror things twice if they were already mirrored. So if the admin decides to delete a specific file, he can just delete it, and mirror won't mirror that file again.


lwp-mirror, LWP, lwp-request, webmirror


mirror is Copyright (c) 1996 Felix von Leitner. All rights reserved. libwww-perl is Copyright (c) 1995, 1996 Gisle Aas. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Felix von Leitner <>

syntax highlighting: