Python ftpsync

Sync a local folder to FTP using Python, based on this script, added explicit SSL support. Updated it for Python 3.

Usage

Change to the folder that you want to sync, and run ftpsync, the .ftpsync is stored in that folder, instead of on the FTP server.

cd /media/whatever/whatever
ftpsync user:password@test.com/path/to/upload/to --ssl
usage: ftpsync [-h] [-p port] [--ssl] [-c [C [C ...]]] [--delete] [--nc NC]
               [--version]
               server

positional arguments:
  server          user:password@server/path/to/folder

optional arguments:
  -h, --help      show this help message and exit
  -p port         port
  --ssl           enable SSL
  -c [C [C ...]]  run raw FTP command
  --delete        delete non-existing files on server side
  --nc NC         update Nextcloud or anything else by URL,
                  https://cloud.example.com/scan.php
  --version       show program's version number and exit

Licenses


MIT License

Copyright (c) 2013-2017 Dariusz Dawidowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Modified code Copyright (c) 2017 Thomas Vanvalkinburgh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Changelog

v2.0.2
  • Fixed a bug, if there's a blank new line, it will add it to the ignore list, and it won't upload anything.
v2.0.1
  • Added a --nc option, will send a GET request to whatever URL you specify.
  • Custom commands using -c should work now.
  • Changed the opening of files to use with open.

Download

ftpsync v2.0.2
ftpsync v2.0.1
scan.php

Related