u2c.py
Theu2c.py (upload to copyparty) client is a standalone Python script for uploading files and folders to a copyparty server using the up2k protocol.
Synopsis
Description
u2c.py is a robust upload client with features including:- Parallel uploads with configurable connections
- Multi-threaded file hashing
- Automatic resume of interrupted uploads
- File deduplication (only uploads missing chunks)
- File search mode
- Progress tracking with ETA
- Cross-platform (Python 2.6+ and 3.3+)
- Zero dependencies
Required Arguments
string
required
Server URL including destination folder.Examples:
http://192.168.1.100:3923/uploads/https://files.example.com/music/albums/
string
required
Files and/or folders to upload (multiple allowed).Note: Uses rsync-style syntax:
foouploads entire folder to URL/foo/foo/uploads contents of folder into URL/
Authentication Options
string
Password for copyparty authentication (sent in ‘PW’ header).Can be:
- Plain password:
-a hunter2 - Username:password if
--usernamesenabled:-a alice:hunter2 - Path to file containing password:
-a $~/.copyparty-pass
string
Password for HTTP basic authentication (usually not necessary).
Upload Behavior
boolean
Search mode - search for files instead of uploading.
boolean
Continue even if some local files are inaccessible.
boolean
If last-modified timestamps differ, push local timestamp to server.Requires: Write and delete permissions on server.
boolean
Overwrite existing files instead of auto-renaming.
boolean
Overwrite existing files only if server file is older.
string
Skip files matching regex pattern (repeatable).Example:
-x '.*/\.git/.*' -x '.*\.tmp$'Output Options
boolean
Verbose output (show detailed errors).
boolean
Print list of download links after all uploads finish.
boolean
Print download link after each upload finishes.
path
Write list of download links to file.Example:
-uf ~/upload-links.txtboolean
Print upload/hash speeds for each file.
Performance Options
integer
default:"2"
Number of parallel upload connections.Recommended:
1-2for low latency (same country)2-4for mobile clients2-6for high latency (cross-continental)
integer
default:"3"
Number of CPU cores to use for hashing.Values:
0or1- Single-threaded hashing2-4- Recommended for most systems- Higher values show diminishing returns
integer
default:"64"
Target POST size in MiB (tries to make each upload this big).
integer
default:"96"
Maximum POST size in MiB (never exceed this).Note: Cloudflare maximum is 96 MiB.
boolean
Disable hashing while uploading (reduces parallelism).
boolean
Skip files if they exist at destination with similar timestamp.Note: Like turbo mode but even faster; skips files without hashing.
boolean
Use simple fallback approach (no parallelism, easier to debug).
float
default:"57"
Assume HTTP connections expire after this many seconds.
float
default:"5"
Delay in seconds before retrying failed handshake/upload.
float
default:"186"
Crash if handshakes fail due to server offline for this many seconds.
Folder Sync Options
boolean
Delete local files after successful upload.
boolean
Delete remote files that don’t exist locally (implies
--ow).boolean
Delete remote files during upload instead of after.Note: Reduces peak disk usage but will re-upload instead of detecting renames.
File-ID Calculator
When URL is-, u2c calculates and lists file warks (identifiers) instead of uploading.
string
default:"hunter2"
Salt for creating warks (must match server config).
boolean
Verbose mode - print hash/offset of each chunk in each file.
boolean
Just print identifier + filepath (omit mtime/size).
TLS/SSL Options
path
Path to CA certificate or server certificate to verify.Example:
-te /path/to/cert.pemboolean
Require correct hostname in certificate.
boolean
Disable TLS certificate verification (insecure).
Compatibility Options
boolean
Clear screen before starting upload.
integer
default:"0"
Resolve hostname N times before upload.Note: Good for buggy networks but breaks TLS certificate validation.
boolean
No status panel (for slow consoles and macOS).
Examples
Basic upload
Upload with authentication
Fast parallel upload
Resume-friendly upload
Sync folder
Search for files
Upload with links
Calculate file IDs
Technical Details
Up2k Protocol
The up2k protocol used by u2c:- Hashing - Files are split into chunks (1-32 MiB) and SHA-512 hashed
- Handshake - Client sends chunk hashes to server
- Server Response - Server indicates which chunks are needed
- Upload - Only missing chunks are uploaded
- Assembly - Server assembles file from chunks
- Deduplication (same file uploaded once)
- Resume (interrupted uploads continue from where they left off)
- Bandwidth savings (only new data is transferred)
Chunk Size Selection
Chunk sizes are automatically selected based on file size:- Files < 256 MiB: 1 MiB chunks
- Files 256 MiB - 8 GiB: 2-8 MiB chunks
- Files > 8 GiB: Up to 32 MiB chunks
File Naming
By rsync convention:foldercreates URL/folder/ with folder contentsfolder/uploads contents directly into URL/
Exit Codes
0- Success1- Error (authentication failed, server offline, etc.)