ftputil is a high-level FTP client library for the Python programming language. It implements a virtual file system for accessing FTP servers, providing many functions similar to those in the `os`, `os.path`, and `shutil` modules. It also offers convenience functions for conditional uploads and downloads, and handles FTP clients and servers in different timezones. The current stable version is 5.1.0, released on 2024-01-06. The project follows semantic versioning, with major version changes indicating backward incompatibility. Releases are announced on its mailing list.
pip install ftputilVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to an FTP server, list files, download a file, create a remote directory, and upload a file using `ftputil.FTPHost`. It uses environment variables for credentials for security and easy testing.
If hidden files are required, custom session factories or other workarounds may be needed, or consider explicit filtering if the server supports different `DIR` options.
Review and adjust time shift calculations or call `ftp_host.synchronize_times()` to ensure correct time synchronization between client and server.
Upgrade to the latest 5.x.x version and test thoroughly. If using custom `session_factory` implementations, review against Python 3.9+ `ftplib` changes.
Always construct full paths using `ftp_host.path.join(parent_path, name)` before passing them to `isdir`, `isfile`, `islink`, or similar methods if the `name` isn't from `ftp_host.curdir`.
Avoid calling `lstat` directly on the root path '/'. For checks on the root, use `listdir('/')` to see its contents instead.Ensure correct time zone synchronization using `ftp_host.synchronize_times()`. Be aware that if timestamps are only minute-precise, ftputil errs on the side of transferring too much data. For interrupted transfers, consider using `upload`/`download` directly or explicitly removing the incomplete remote file before retrying `upload_if_newer`.
No dependency data recorded yet.