A Telegram file transfer tool based on Telethon, supporting folder upload, download, and synchronization.
- Folder upload, download, and synchronization
- Resume broken transfers
- Sync support
- Real-time progress display
- File integrity verification
- Session management
- Topic Group support
- Auto-ignore system files (.DS_Store, pycache, etc.)
- Clone the repository:
git clone https://github.com/ooopus/telegramTransfer.git
cd telegramTransfer
- Install dependencies:
pip install -r requirements.txt
- Configuration:
Create a
config.toml
file:
[api]
id = ""
hash = ""
[session]
dir = "~/.config/telegramTransfer/sessions"
name = "default"
[transfer]
chunk_size = 2097152
retry_times = 3
timeout = 300
upload_order = "none" # name_asc, name_desc, size_asc, size_desc, none
[logging]
level = "INFO"
[filters]
exclude = [
".DS_Store",
"Thumbs.db",
".git/",
"__pycache__/",
"*.pyc",
".*.swp",
".env"
]
include = ["*"]
Get your API ID and Hash from https://my.telegram.org.
# Upload folder
python -m telegramTransfer upload /path/to/folder --to username
# Upload to Topic Group
python -m telegramTransfer upload /path/to/folder --to https://t.me/c/2257928502/336
# Download folder
python -m telegramTransfer download /path/to/folder --from username
# Sync folder to cloud
python -m telegramTransfer upload /path/to/folder --to username --sync
# Sync folder to local
python -m telegramTransfer download /path/to/folder --from username --sync
folder
: Path to the folder to process--to
: Target user/channel, supports the following formats:- Numeric ID (e.g., 4639628806)
- Username (e.g., @username)
- Topic Group Link (e.g., https://t.me/c/2257928502/336)
--from
: Source user/channel, supports the same formats as --to--caption
: File description template, supports the following variables:- {path}: Relative file path
- {size}: File size
- {mtime}: File modification time
--session
: Specify session name--new-session
: Force create new session--api-id
: Telegram API ID--api-hash
: Telegram API Hash--sync
: Enable sync mode
-
Resume Broken Transfers:
- Continue from where it left off after interruption
- File integrity verification
- Auto-skip uploaded files
- Auto-handle duplicate files
-
Topic Group Support:
- Upload files to specific Topics
- Auto-handle private channel ID conversion
- Keep messages in correct Topics
-
File Filtering:
- Auto-ignore system and temporary files
- Custom filter rules
- Wildcard pattern matching
-
Session Management:
- Multi-account support
- Session persistence
- Automatic login
- Two-factor authentication support
-
File Verification:
- Auto-verify before and after upload
- Detect file size inconsistencies
- Display detailed verification results
- Auto-handle file conflicts
- First-time use requires login verification
- Stable network connection recommended
- Large file transfers may be limited by Telegram
- Please comply with Telegram's Terms of Service
- Special characters in filenames are handled correctly
- Sync mode will delete excess files at the destination
This project is open-sourced under the GNU General Public License v3 (GPLv3).