Skip to main content

Ftplib Shutil like functionality

Project description

Overview

This is a FTP library that provides simple means for downloading and uploading files. It can be installed using python3 setup tools works.

python setup.py install

You can use directly ftpshutil/ftpshutil.py file in your project instead of installing with setup tools.

API

General

The walk_ftp_dir method might be used to traverse a directory tree. As the first argument accepts the FTPShutil object.

def walk_ftp_dir(ftp, root_dir):

This can be used therefore like:

ftp = FTPShutil(server,user,password)
for root, dirs, files in walk_ftp_dir(ftp, "MyDirectory"):
    print(dirs)
    print(files)

FTPShutil class

Can be observed using examples/ftpmgr.py. Provides FTPShutil class with the following methods:

  • downloadtree
    def downloadtree(self, directory, destination):
    
    
  • uploadtree
    def uploadtree(self, directory, destination):
    
  • uploadfile
    def uploadfile(self, local_file, remote_file):
    
  • downloadfile
    def downloadfile(self, remote_file, local_file):
    
  • listdir. Returns list of files / directories withing the location.
    def listdir(self, root_dir):
    
  • listdir_ex. Returns list of directories and files in the root_dir (as a tuple of two lists)
    def listdir_ex(self, root_dir):
    
  • write. Allows to create a file with the specified data.
    def write(self, file_path, data):
    
  • read. Allows to read contents of a file.
    def read(self, file_path):
    
  • mkdir
    def mkdir(self, path):
    
  • makedirs
    def makedirs(self, path):
    
  • rename
    def rename(self, fromname, toname):
    
  • exists
    def exists(self, path):
    
  • isdir
    def isdir(self, dir_path):
    
  • isfile
    def isfile(self, dir_path):
    
  • remove_file
    def remove_file(self, path):
    
  • remove_dir
    def remove_dir(self, path):
    
  • rmtree
    def rmtree(self, directory):
    
  • get_ftplib_handle
    def get_ftplib_handle(self):
    
  • quit
    def quit(self):
    

API with CRC synchronization

Sometimes you do not want to transfer entire page into the Internet. You have a webpage, you modified one page and you need to transfer only that page, not entire image assets of your page. For every directory on your local file system a CRC checksum file is generated. If the checksum of that directory is exactly the same as the remote checksum, then this directory is skpped

Download with CRC checking:

  • downloadfile_sync
    def downloadfile_sync(self, remote_file, local_file):
    

Upload with CRC checking:

  • downloadfile_sync
    def downloadfile_sync(self, remote_file, local_file):
    

It is important to know that right now the entire directory is transferred, is something is changed.

The CRC file is a simple INI file format, with one section. It contains a list of files with checksum values, and directory listing.

Other

You can try installing this using pip. I have not checked if that works.

pip install git+https://github.com/rumca-js/ftplibshutil.git#egg=ftpshutil-renegat0x0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ftpshutil-0.0.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file ftpshutil-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ftpshutil-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.5

File hashes

Hashes for ftpshutil-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b3c485d5f66fbe9dafab0afdcffc9321f41068519860ff8720a45ac9c92c473
MD5 87fd4207e1e77488091b307806c13ecd
BLAKE2b-256 110c29b6fe898428d2a364b037746165d5c409aa1a827f92eaa444ff7097f1b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page