A command-line tool for uploading files and directories to Drime Cloud. This library was influenced by the great filen.io cli tool and it's sync lib.
PyDrime is an unofficial, community-developed library and is not affiliated with, endorsed by, or supported by Drime or the Drime Cloud service.
This 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.
Use at your own risk. The authors are not responsible for any data loss, corruption, or other issues that may arise from using this tool. Always maintain backups of your important data.
- Upload individual files or entire directories
- Download files and folders by name, ID, or hash
- Sync local directories with Drime Cloud (bidirectional and one-way modes)
- Encrypted Vault for secure file storage with client-side encryption
- Recursive directory scanning
- Progress tracking with visual feedback
- Dry-run mode to preview uploads
- Parallel uploads/downloads with configurable workers
- Duplicate file detection and removal
- Support for environment-based configuration
- Rich terminal output with colors
- JSON output for scripting and automation
# Clone the repository
git clone https://github.com/holgern/pydrime.git
cd pydrime
# Install in development mode
pip install -e .
# Or install with dev dependencies
pip install -e ".[dev]"
# Or install with dev dependencies
pip install -e ".[dev]"
pkg install -y rust binutilspip install pydrimeBefore using the tool, you need to configure your Drime Cloud API credentials.
The easiest way to configure your API key:
pydrime initThis will:
- Prompt you for your API key
- Validate the key with Drime Cloud
- Store it securely in
~/.config/pydrime/config - Set appropriate file permissions (owner read/write only)
export DRIME_API_KEY="your_api_key_here"Create a .env file in your project directory:
cp .env.example .env
# Edit .env and add your API keyPass the API key directly when running commands:
pydrime upload /path/to/file --api-key "your_api_key_here"The tool checks for API keys in the following order (highest to lowest priority):
- Command-line
--api-keyargument DRIME_API_KEYenvironment variable~/.config/pydrime/configfile- Local
.envfile
Configure your API key (first time only):
pydrime initVerify your API key and connection:
pydrime statuspydrime upload /path/to/file.txtpydrime upload /path/to/file.txt --workspace 123pydrime upload /path/to/directorypydrime upload /path/to/file.txt --remote-path "folder/file.txt"pydrime upload /path/to/directory --dry-runPyDrime provides real-time progress tracking during uploads with three modes:
Rich Interactive Progress (default):
pydrime upload /path/to/folderShows an animated progress bar with file names, transfer speed, and ETA.
Simple Text Progress (CI/CD friendly):
pydrime upload /path/to/folder --simple-progressOutputs clean line-by-line progress suitable for logs and CI/CD pipelines.
No Progress (silent mode):
pydrime upload /path/to/folder --no-progressDisables all progress output for automated scripts.
Upload multiple files simultaneously for faster transfers:
pydrime upload /path/to/folder -j 10The -j flag controls the number of parallel uploads (default: 5, max: 20).
Control how duplicate files are handled during upload:
Skip duplicates (default):
pydrime upload /path/to/folder --on-duplicate skipRename duplicates:
pydrime upload /path/to/folder --on-duplicate renameAutomatically renames files like file.txt → file (1).txt.
Replace duplicates:
pydrime upload /path/to/folder --on-duplicate replaceReplaces existing files with the new version (old files moved to trash).
Ask for each duplicate:
pydrime upload /path/to/folder --on-duplicate askPrompts for each duplicate file individually.
List files in root:
pydrime lsList files in a specific folder (by ID):
pydrime ls 12345Search for files:
pydrime ls --query "report"Create folder in root:
pydrime mkdir "My Folder"Create folder in a specific parent (by ID):
pydrime mkdir "Subfolder" --parent-id 12345Download a single file:
pydrime download abc123hashDownload multiple files:
pydrime download hash1 hash2 hash3Download to specific location:
pydrime download abc123hash --output /path/to/save/file.txtRename by ID:
pydrime rename 12345 "New File Name.txt"Rename by name (in current directory):
pydrime rename "oldname.txt" "newname.txt"Rename with description:
pydrime rename 12345 "New Name" --description "Updated file"Move to trash by ID:
pydrime rm 12345Delete by name (in current directory):
pydrime rm test.txtDelete folder by name:
pydrime rm drime_testDelete multiple files (mix IDs and names):
pydrime rm 12345 test.txt folder_nameDelete permanently (cannot be undone):
pydrime rm 12345 --permanentCreate a shareable link by ID:
pydrime share 12345Share by name (in current directory):
pydrime share test.txtCreate password-protected link:
pydrime share 12345 --password "mypassword"Create link with expiration:
pydrime share 12345 --expires "2025-12-31T23:59:59.000000Z"Create link allowing edits:
pydrime share 12345 --allow-edit --allow-downloadpydrime workspacesSynchronize local directory with Drime Cloud:
# Default two-way sync
pydrime sync ./my_folder
# Sync with specific remote path
pydrime sync ./docs -r remote_docs
# Preview sync changes (dry run)
pydrime sync ./data --dry-run
# Using sync modes explicitly (format: local:mode:remote)
pydrime sync /home/user/docs:twoWay:/Documents
pydrime sync ./backup:localBackup:/BackupSync Modes:
twoWay(tw) - Mirror changes in both directionslocalToCloud(ltc) - Upload local changes onlylocalBackup(lb) - Upload to cloud, never deletecloudToLocal(ctl) - Download cloud changes onlycloudBackup(cb) - Download from cloud, never delete
Ignore Files (.pydrignore):
You can exclude files from sync and upload operations by creating .pydrignore files.
These work like .gitignore files with support for gitignore-style patterns:
# Example .pydrignore file
*.log # Ignore all .log files
node_modules/ # Ignore node_modules directory
!important.log # But keep important.log
/build # Ignore build only at root
**/cache/** # Ignore cache directories anywhere.pydrignore files are hierarchical - rules in subdirectories can override parent
rules.
Find and optionally delete duplicate files:
# Show duplicates (dry run)
pydrime find-duplicates
# Find in specific folder recursively
pydrime find-duplicates --folder "My Documents" --recursive
# Actually delete duplicates (moves to trash)
pydrime find-duplicates --deleteCheck your storage usage:
pydrime usageThe vault provides encrypted file storage with client-side encryption:
# Show vault information
pydrime vault show
# Unlock vault for current session
eval $(pydrime vault unlock)
# List vault files
pydrime vault ls
pydrime vault ls MyFolder
# Upload file to vault (will prompt for password)
pydrime vault upload secret.txt
pydrime vault upload document.pdf -f MyFolder
# Download file from vault
pydrime vault download secret.txt
pydrime vault download secret.txt -o decrypted.txt
# Delete vault file
pydrime vault rm secret.txt
# Lock vault (clear password from session)
eval $(pydrime vault lock)PyDrime can run a restic REST server backed by Drime Cloud storage, allowing you to use restic for backups without managing local storage. This feature uses your existing pydrime credentials automatically.
pip install pydrime[server]# Start server (uses your pydrime credentials)
pydrime server restic
# Server runs on http://localhost:8000
# Now use restic with this URL:
restic -r rest:http://localhost:8000/mybackup init
restic -r rest:http://localhost:8000/mybackup backup ~/Documents--listen :PORT: Change server port (default: 8000)--workspace ID: Use specific workspace (default: your pydrime default)--htpasswd-file FILE: Enable authentication with htpasswd file--append-only: Prevent deletions (safer for backups)--tls: Enable HTTPS (requires --tls-cert and --tls-key)--debug: Show detailed logs--no-verify-upload: Disable upload verification (not recommended)
# Start on custom port
pydrime server restic --listen :9000
# Use specific workspace
pydrime server restic --workspace 1593
# Enable authentication
pydrime server restic --htpasswd-file ~/.htpasswd
# Append-only mode (recommended for production)
pydrime server restic --append-only
# HTTPS mode
pydrime server restic --tls --tls-cert cert.pem --tls-key key.pem- Authentication is disabled by default for convenience
- For production use, enable authentication with
--htpasswd-file - Consider using
--append-onlyto prevent accidental deletions - Use
--tlsfor encrypted connections
Once the server is running:
# Initialize repository
restic -r rest:http://localhost:8000/myrepo init
# Create backup
restic -r rest:http://localhost:8000/myrepo backup ~/data
# List snapshots
restic -r rest:http://localhost:8000/myrepo snapshots
# Restore
restic -r rest:http://localhost:8000/myrepo restore latest --target ~/restoreRun an S3-compatible server backed by Drime Cloud storage. This allows you to access your Drime files using any S3-compatible client (AWS CLI, rclone, s3cmd, etc.).
pip install pydrime[server]This installs both pyrestserver and pys3local packages needed for server
functionality.
# Start S3 server (no authentication by default)
pydrime server s3
# Start on custom port
pydrime server s3 --listen :9001
# Enable authentication with custom credentials
pydrime server s3 --access-key-id mykey --secret-access-key mysecret --no-auth=false
# Limit access to specific folder
pydrime server s3 --root-folder /backup
# Use specific workspace
pydrime server s3 --workspace 123--listen TEXT: Listen address (default::9000)--access-key-id TEXT: AWS access key ID (default:minioadmin)--secret-access-key TEXT: AWS secret access key (default:minioadmin)--region TEXT: AWS region name (default:us-east-1)--no-auth: Disable authentication (default: enabled)--workspace INTEGER: Workspace ID (uses pydrime default if not specified)--root-folder TEXT: Root folder path to limit S3 access scope--debug: Enable debug logging
- Authentication is DISABLED by default for convenience
- To enable authentication, remove the
--no-authflag and set custom credentials - When authentication is enabled, clients must use the configured access key and secret
- Always use authentication for production deployments or public-facing servers
AWS CLI:
# Without authentication (default)
aws s3 ls --endpoint-url http://localhost:9000 --no-sign-request
aws s3 cp file.txt s3://mybucket/ --endpoint-url http://localhost:9000 --no-sign-request
# With authentication
aws configure set aws_access_key_id minioadmin
aws configure set aws_secret_access_key minioadmin
aws s3 ls --endpoint-url http://localhost:9000rclone:
# Without authentication
rclone lsd s3server: --s3-endpoint http://localhost:9000 --s3-no-check-bucket
# With authentication - add to rclone config
[s3server]
type = s3
provider = Other
endpoint = http://localhost:9000
access_key_id = minioadmin
secret_access_key = minioadmins3cmd:
# Configure s3cmd
s3cmd --configure
# Use with custom endpoint
s3cmd --host=localhost:9000 --host-bucket=localhost:9000 ls# Start S3 server in background
pydrime server s3 &
# Upload files via AWS CLI
aws s3 cp myfile.txt s3://mybucket/ --endpoint-url http://localhost:9000 --no-sign-request
# Sync directory with rclone
rclone sync /local/path s3server:mybucket --s3-endpoint http://localhost:9000
# Use as backup target
aws s3 sync /data s3://backup/ --endpoint-url http://localhost:9000Run a WebDAV server backed by Drime Cloud storage. This allows you to mount your Drime files as a network drive on Windows, macOS, or Linux.
pip install pydrime[server]This installs the pywebdavserver package along with pyrestserver and pys3local
needed for full server functionality.
# Start WebDAV server (no authentication by default)
pydrime server webdav
# Start on custom port
pydrime server webdav --port 9090
# Enable authentication
pydrime server webdav --username myuser --password mypass --no-auth=false
# Start in read-only mode
pydrime server webdav --readonly
# Use specific workspace
pydrime server webdav --workspace 123
# Enable HTTPS
pydrime server webdav --ssl-cert cert.pem --ssl-key key.pem--host TEXT: Host address to bind to (default:0.0.0.0)--port INTEGER: Port number to listen on (default:8080)--username TEXT: WebDAV username for authentication--password TEXT: WebDAV password for authentication--no-auth: Disable authentication (default: enabled)--readonly: Enable read-only mode (no writes allowed)--workspace INTEGER: Workspace ID (uses pydrime default if not specified)--cache-ttl FLOAT: Cache TTL in seconds for Drime backend (default:300.0)--max-file-size INTEGER: Maximum file size in bytes (default: 5GB)--ssl-cert PATH: Path to SSL certificate file (for HTTPS)--ssl-key PATH: Path to SSL private key file (for HTTPS)--verbose: Increase verbosity (-v, -vv, -vvv)
- Authentication is DISABLED by default for convenience
- To enable authentication, provide both
--usernameand--password - When authentication is enabled, clients must provide credentials when mounting
- Always use authentication for production deployments or public-facing servers
- Consider using HTTPS with
--ssl-certand--ssl-keyfor encrypted connections
Windows:
- Open File Explorer
- Right-click "This PC" → "Map network drive"
- Enter URL:
http://localhost:8080 - If authentication enabled, provide username and password
Or using command line:
net use Z: http://localhost:8080macOS:
- Open Finder
- Go → Connect to Server (⌘K)
- Enter URL:
http://localhost:8080 - Click "Connect"
Or using command line:
# Mount to /Volumes/DrimeDrive
mkdir -p ~/DrimeDrive
mount_webdav -S http://localhost:8080 ~/DrimeDriveLinux (GNOME/Nautilus):
# Using Nautilus file manager
nautilus http://localhost:8080
# Or mount with davfs2
sudo apt install davfs2
sudo mount -t davfs http://localhost:8080 /mnt/drimeLinux (KDE/Dolphin):
- Open Dolphin
- Network → Add Network Folder
- Select "WebDAV" and enter URL:
http://localhost:8080
cadaver (WebDAV command-line client):
# Install cadaver
sudo apt install cadaver # Debian/Ubuntu
brew install cadaver # macOS
# Connect to server
cadaver http://localhost:8080
# Commands inside cadaver
ls # List files
get file.txt # Download file
put local.txt # Upload filecurl:
# List files
curl http://localhost:8080/
# Download file
curl http://localhost:8080/file.txt -o file.txt
# Upload file
curl -T myfile.txt http://localhost:8080/myfile.txt
# With authentication
curl -u myuser:mypass http://localhost:8080/# Start WebDAV server with authentication
pydrime server webdav --username admin --password secret --no-auth=false &
# Mount on Linux
sudo mount -t davfs -o username=admin,password=secret http://localhost:8080 /mnt/drime
# Copy files to mounted drive
cp -r /local/data/* /mnt/drime/
# Access from any WebDAV-compatible application
# (e.g., office suites, media players, backup tools)For more advanced configuration options, you can use pywebdavserver directly:
pip install pywebdavserver
pywebdavserver serve --backend-config drime-personalSee the pywebdavserver documentation for more information.
Use pyrestserver directly for more configuration options:
pip install pyrestserver
pyrestserver serveSee the pyrestserver documentation for more information.
Initialize Drime Cloud configuration.
pydrime init [OPTIONS]Options:
-k, --api-key TEXT: Drime Cloud API key (will prompt if not provided)
Description: Stores your API key securely in ~/.config/pydrime/config for future
use. The command validates the API key before saving.
Check API key validity and connection status.
pydrime status [OPTIONS]Options:
-k, --api-key TEXT: Drime Cloud API key
Description: Verifies that your API key is valid and displays information about the logged-in user.
Upload a file or directory to Drime Cloud.
pydrime upload [OPTIONS] PATHArguments:
PATH: Local file or directory to upload
Options:
-r, --remote-path TEXT: Remote destination path with folder structure (e.g., "/folder1/folder2/file.txt")-w, --workspace INTEGER: Workspace ID (default: 0 for personal space)-k, --api-key TEXT: Drime Cloud API key--dry-run: Show what would be uploaded without actually uploading-j, --workers INTEGER: Number of parallel upload workers (default: 5, range: 1-20)--simple-progress: Use simple text progress display (CI/CD friendly)--no-progress: Disable progress display--on-duplicate [skip|rename|replace|ask]: How to handle duplicate files (default: skip)
Description: Uploads files to Drime Cloud with real-time progress tracking. For files larger than 30MB, automatically uses multipart upload for better reliability. Supports parallel uploads for faster transfers and flexible duplicate handling.
List files in a Drime Cloud directory.
pydrime ls [OPTIONS] [PARENT_ID]Arguments:
PARENT_ID: ID of parent folder (omit to list root files)
Options:
-q, --query TEXT: Search query to filter files by name-k, --api-key TEXT: Drime Cloud API key
Description: Lists files and displays them in a formatted table showing ID, name, type, and size.
Create a directory in Drime Cloud.
pydrime mkdir [OPTIONS] NAMEArguments:
NAME: Name of the directory to create
Options:
-p, --parent-id INTEGER: Parent folder ID (omit to create in root)-k, --api-key TEXT: Drime Cloud API key
Download file(s) from Drime Cloud by hash.
pydrime download [OPTIONS] HASH_VALUES...Arguments:
HASH_VALUES: One or more file hashes to download
Options:
-o, --output TEXT: Output file path (for single file only)-k, --api-key TEXT: Drime Cloud API key
Description: Downloads files from Drime Cloud using their hash values. Can download multiple files at once.
Rename a file or folder entry.
pydrime rename [OPTIONS] ENTRY_IDENTIFIER NEW_NAMEArguments:
ENTRY_IDENTIFIER: ID or name of the entry to rename (names are resolved in the current working directory)NEW_NAME: New name for the entry
Options:
-d, --description TEXT: New description for the entry-k, --api-key TEXT: Drime Cloud API key
Examples:
pydrime rename 12345 "newfile.txt" # Rename by ID
pydrime rename test.txt "newfile.txt" # Rename by name
pydrime rename drime_test my_folder # Rename folder by name
pydrime rename test.txt file.txt -d "Desc" # Rename with descriptionDelete one or more file or folder entries.
pydrime rm [OPTIONS] ENTRY_IDENTIFIERS...Arguments:
ENTRY_IDENTIFIERS: One or more entry IDs or names to delete (names are resolved in the current working directory)
Options:
--permanent: Delete permanently (cannot be undone)-k, --api-key TEXT: Drime Cloud API key
Description: Moves entries to trash or deletes them permanently. Requires confirmation before deletion. Supports both numeric IDs and file/folder names.
Examples:
pydrime rm 480424796 # Delete by ID
pydrime rm test1.txt # Delete by name
pydrime rm drime_test # Delete folder by name
pydrime rm test1.txt test2.txt # Delete multiple files
pydrime rm 480424796 drime_test # Mix IDs and names
pydrime rm --permanent test1.txt # Permanent deletionCreate a shareable link for a file or folder.
pydrime share [OPTIONS] ENTRY_IDENTIFIERArguments:
ENTRY_IDENTIFIER: ID or name of the entry to share (names are resolved in the current working directory)
Options:
-p, --password TEXT: Optional password for the link-e, --expires TEXT: Expiration date (format: 2025-12-31T23:59:59.000000Z)--allow-edit: Allow editing through the link--allow-download: Allow downloading through the link (default: True)-k, --api-key TEXT: Drime Cloud API key
Description: Creates a public shareable link for a file or folder with optional password protection and expiration.
Examples:
pydrime share 480424796 # Share by ID
pydrime share test1.txt # Share by name
pydrime share drime_test # Share folder by name
pydrime share test.txt -p mypass123 # Share with password
pydrime share test.txt -e 2025-12-31 # Share with expiration
pydrime share test.txt --allow-edit # Allow editingList all workspaces you have access to.
pydrime workspaces [OPTIONS]Options:
-k, --api-key TEXT: Drime Cloud API key
Description: Shows workspace name, ID, your role, and owner information for all workspaces you have access to.
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src/
# Lint code
ruff check src/This tool is designed to work with the Drime Cloud API. The current implementation includes placeholder endpoints that need to be updated based on the actual API documentation.
The following files contain placeholder API endpoints that should be updated once the API documentation is available:
pydrime/api.py: Updateupload_file(),create_directory(), andlist_files()endpoints- Authentication method may need adjustment based on actual API requirements
Make sure you've set the DRIME_API_KEY environment variable or created a .env file
with your API key.
If you encounter permission errors when scanning directories, the tool will skip those files and continue with accessible ones.
Verify that:
- Your API key is valid
- You have internet connectivity
- The Drime Cloud API is accessible (not behind a firewall)
MIT License - see LICENSE file for details