The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

turbo-ftp-sync - a script moves changes of files and folders of a local machine to a remote one via FTP very fast with minimum network traffic.

SYNOPSIS

turbo-ftp-sync [ options ] [ <localdir> <remoteURL> ]

DESCRIPTION

The script synchronizes files and folder on an FTP server with local ones via usual FTP protocol. The advantage of this script over usual FTP client is it doesn't upload all data every time but only once.

Its secret is that it doesn't ask a FTP server about last modification date and current size of each file. These information is stored in local SQLite db. Therefore this program doesn't explore folder tree of a remote host. It acts blindly. You can interrupt a process of this program in any time and you will not lose changes which you already uploaded.

The program can move changes only one direction from a local machine to remote one. If a file was changed on a remote machine and a local one then the program overwrite the remove version of the file by the local one.

turbo-ftp-sync.pl is based on sources of ftpsync.pl program. Christoph Lechleitner is the initial author of ftpsync.pl (ftpsync@ibcl.at)

OPTIONS

<localdir>

local directory, by default is current one(.)

<remoteUrl>

full FTP URL

ftp://[ftpuser[:ftppasswd]@]ftpserver/ftpdir 

ftpdir is relative, so

ftp://[ftpuser[:ftppasswd]@]ftpserver// for absolute paths
-c | -C

like -i, but then prompts whether to actually do work

-d | -D

turns debug output (including verbose output) on

-f | -F

flat operation, no subdir recursion

-h | -H

prints out this help text

-i | -I

forces info mode, only telling what would be done

-n | -N

no deletion of obsolete files or directories

-l | -L

follow local symbolic links as if they were directories

-q | -Q

turns quiet operation on

-b | -B

build DB only - i.e don't upload data to remote host. For example you have alread upload an archive to a remote host and extracted it. Then the remove copy of data equals to local one. And reuploading all data yet another time with this script is redundant.

# Instead.
turbo-ftp-sync.pl db=db.db wroot ftp://ftp.com//

# Use
turbo-ftp-sync.pl -b db=db.db wroot 
# here you change something in wroot folder
turbo-ftp-sync.pl db=db.db wroot ftp://ftp.com//
-v | -V

turnes verbose output on

maxerrors

if not 0 then program exit with nonzero code.

cfg

read parameters and options from file defined by value.

ftpserver

defines the FTP server, defaults to "localhost".

ftpuser

defines the FTP user, defaults to "ftp".

db

defines the file where info about uploaded files is stored.

ftppasswd

defines the FTP password, defaults to "anonymous".

ignoremask

defines a regexp to ignore certain files, like .svn

EXAMPLE of using maxerrors feature

It allow to self terminate process if it was encountered definite number failure attempts to upload a file or a dir. Usually such situation means your free ftp server bans you. And it bases on experiency the better decision is to termitate program with error. But it's the end. We don't surrender! We've foreseen that.

while : ; do 
  turbo-ftp-sync.pl db=db.db wroot ftp://ftp.com// && break ; 
done

VERSION

0.6

AUTHOR

Daneel S. Yaitskov <rtfm.rtfm.rtfm@gmail.com>

COPYRIGHT

Copyright (c) 2011, Daneel S. Yaitskov <rtfm.rtfm.rtfm@gmail.com>

All rights reserved.

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

SCRIPT CATEGORIES

Networking Web