Es wird mindestens Python 2.7 benötigt und wer SSH nutzen möchte, braucht das Paramiko library.
ftpupload.py (Erste Version)
ftpupload.py (Zweite Version)
ftpupload.py (Dritte Version, 11. Oktober 2010)
ftpupload.py (Vierte Version, 13. März 2011)
ftpupload.py (Fünfte Version, 5. Juni 2011)
ftpupload.py (Letzte Version, 30. April 2012)
Code: Alles auswählen
usage: ftpupload.py [-h] [-q] [-a] [-s] [-t] [-k] [-f] [-tls | -ssh] [--ascii]
[--keepalive INT] [--keyfile PATH] [--certfile PATH]
[--skip PATTERN [PATTERN ...]] [--fileauth PERM]
[--dirauth PERM] [--rules PATH] [--types PATH]
[--destination PATH] [--timeout INT] [--user USER]
[--pass PASS] [--port PORT]
host data [data ...]
File and directory uploading/mirroring to a ftp server.
positional arguments:
host The servers ip or hostname to connect to.
data Files and directories to be uploaded.
optional arguments:
-h, --help show this help message and exit
-q No output to the screen will be made.
-a Uses active mode instead of passive. (Ignored if SSH!)
-s Synchronizes the given directories.
ATTENTION: This will delete everything on the server
that is not present on your local machine!
-t Synchronizes based on the modification times,
instead of the filesize.
-k Keep the modification times of stored files.
(If possible.)
-f Every statement within data will be used as list file.
-tls Use TLSv1 to secure the connection.
-ssh Use SSH to secure the connection
--ascii Use ascii transfer instead of binary. (Ignored if SSH!)
--keepalive INT Send keepalive packets to an SSH protected server.
(Default: off)
--keyfile PATH The keyfile to use. (Only used if in TLS mode!)
--certfile PATH The certfile to use. (Only used if in TLS mode!)
--skip PATTERN [PATTERN ...]
Skip files which matches pattern.
--fileauth PERM The permission to set for files.
--dirauth PERM The permission to set for directories.
--rules PATH The path to the rule file to use.
--types PATH The path to the type file to use.
--destination PATH The path where to upload the data. (Default: root)
--timeout INT Wait before canceling connection attempt. (Default: 5)
--user USER The user to login. (Default: anonymous)
--pass PASS The password for the given user.
--port PORT The servers port to use. (Default: 21)
**A list file works as follows**
If you do not want to specify the files or directories to upload within the
command line, you can use one or more text files instead. Every line will be
parsed and if a string refers to a valid file or directory, it will be stored.
**The rule file works as follows**
If you want more control over the permissions to set, you can create a rule
file. Within this file you can specify different permissions for different
filetypes. If the type of a file that has been uploaded is specified in this
rule file, this permission will be set, otherwise the global permission (If
given) will be set.
The syntax of the rule file is like a ini-file without sections:
.txt=0700
.zip=0755
.php=0644
**The type file works as follows**
If you are uploading many files in a row, you can create a type file to control
which types of files are being transfered with ascii mode. Just enter every
type with its leading dot on a single line within this file.
Please note that this file will have no effect if you are using the --ascii
option.