ftpcopy - mirror or copy files from a FTP server
ftpcopy ftp://host[:port]/directory local-directory
or
ftpcopy host[:post] /directory local-directory
ftpcopy copies a FTP site recursivly. It afterwards deletes all files in the local directory tree which were not found on the remote site.
Number of tries to connect and log in. The default is 1, meaning that ftpls will give up after the first error.
This option was added in version 0.3.0.
Use PASS as password to login on the ftp server. The default is `anonymous@invalid.example'. Use an empty password to enforce not sending any password.
Use NAME to login on the ftp server. The default is `anonymous'. Use an empty name to force to not log in.
Only create the directory hierarchie, do not download files. Any file in the tree will be deleted unless the -n option is also given. Note: if the -s option is also given then even symbolic links to files will be created (without the files, of course).
download only files modified in the last NUMBER days.
Exclude files and directories matching WILDCARD (note that this means shell style wildcards, not regular expression like those of grep). You can repeat that option as often as you want. You can intermix it with the -i option.
Include files and directories matching WILDCARD. You can repeat that option as often as you want. You can intermix it with the -x option.
This option was added in version 0.3.0.
controls the amount of logging done:
0: nothing except warnings and error messages
1: downloads and deletes
2: links/symlinks created, files we already got
3: useless stuff
The default is 1.
Add OPTS to LIST command. This allows to pass arbitrary options to the FTP servers LIST command. Note that ftpcopy does not cope well with recursive directory listings.
This option was added in version 0.3.0.
do not delete files. This influences the cleanup step, it doesn't stop ftpcopy from deleting files during the downloads.
Remove directories which are `in our way'. If an existing local directory blocks the operation because it has to be replaced by something else (a symbolic link or a file) then this option will allow ftpcopy to delete the local directory recursivly. Note that this option is currently not the default, but may be the default in a few months.
This option was added in version 0.3.0.
Keep directories, even it they are blocking our operation. Note that ftpcopy will not continue in that case. This option is currently the default, but that may change.
This option was added in version 0.3.0.
Deal with symbolic links. This is only useful to mirror sites which create listings through /bin/ls. This will fail if a file name in a link contains a ` -> ' sequence.
In- and exclude lists are internally mixed together, keeping the order in which they were given. The list starts with an implicit include *. ftpcopy honors the last match.
The wildcard matching is done against the full remote path of the file. The / character has no special meaning for the matching: it is treated like any other.
Note: you have to include top level directories of files or directories you want to include. Something like this will not work:
--exclude "*" --include "/w/h/e/r/e/file.c"
You need to include /w, /w/h and so on.
ftpcopy \
--exclude '*.cdb' \
--exclude '*software/precompiled*' \
cr.yp.to / /private/file/0/mirror/cr.yp.to
This means:
i'm not interested in .cdb files
precompiled stuff is also not downloaded
the host to connect to is cr.yp.to
the remote directory is /
the local directory is /private/file/0/mirror/cr.yp.to
Uwe Ohse, uwe@ohse.de