NAME
upfiles -- upload files to an FTP server, for push mirroring
SYNOPSIS
upfiles [--options]
DESCRIPTION
Upfiles uploads changed files from your local disk to an FTP server, for a simple kind of "push" mirroring.
Create files locally with the same directory structure as the target, and in a ~/.upfiles.conf file give the locations,
upfiles (local => '/my/directory',
remote => 'ftp://fred@some-server.org/pub/fred');
This is actually Perl code, so you can put comment lines with #
, write some conditionals, use $ENV{HOME}
, etc. Then to upload run
upfiles
Your username on the remote system is in the target URL in the usual way. The password is taken from ~/.netrc
the same as for the ftp
program and other programs. See netrc(5) or Net::Netrc for the format.
upfiles records what has been sent in an SQLite database file .upfiles.sqdb in each local toplevel directory, like /my/directory/.upfiles.sqdb. Changes are identified by comparing file mtimes and sizes against the database. This is much faster than asking the remote server what it's got each time.
For convenience some files in local directories are always excluded from the upload. Currently this is
.upfiles.sqdb from upfiles itself
foo~ Emacs backups
#foo# Emacs autosaves
.#foo Emacs lockfiles
CONFIGURATION
Each upfiles
call in ~/.upfiles.conf takes the following parameters,
local
(string)-
The local directory to upload from.
remote
(string)-
The remote FTP server to upload to, as a URL. The path in the URL is the target directory, and if your username on the remote machine is not the same as your local username then include it with "@" syntax, like
remote => 'ftp://fred@some-server.org/pub/fred',
exclude_regexps
(arrayref of regexps)-
Additional filenames to exclude. For example to exclude a local Makefile
upfiles (local => '/my/directory', remote => 'ftp://some-server.org/pub/fred', exclude_regexps => [ qr{/(^|/)[Mm]akefile$} ]);
COMMAND-LINE OPTIONS
The command line options are
- -n, --dry-run
-
Show what would be uploaded to or deleted from the server, but don't actually do anything.
upfiles -n
- --help
-
Print some brief help information.
- -V, --verbose, --verbose=N
-
Print some diagnostics about what's being done. With --verbose=2 or --verbose=3 print some technical details too.
upfiles --verbose
- --version
-
Print the upfiles program version number. With
--verbose=2
also print the version numbers of some modules used.
FILES
- ~/.upfiles.conf
-
Configuration file.
- ~/.netrc
-
FTP password file.
- $localdir/.upfiles.sqdb
-
SQLite database of information about what has been sent.
BUGS
Changing a local file from a file to a directory or vice versa probably doesn't work very well. Remove it and upload, then create the new form and upload that.
SEE ALSO
Net::FTP, netrc(5), Net::Netrc, DBD::SQLite
HOME PAGE
http://user42.tuxfamily.org/upfiles/index.html
(Upfiles is good for uploading to tuxfamily.)
LICENSE
Copyright 2009, 2010, 2011 Kevin Ryde
Upfiles is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Upfiles is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Upfiles. If not, see http://www.gnu.org/licenses/.