generated from nhcarrigan/template
ADB File Transfer Scripts
Easy-to-use bash scripts for transferring files between your computer and Android device using ADB.
Prerequisites
- Android Debug Bridge (ADB) installed and in your PATH
- USB debugging enabled on your Android device
- Device connected via USB cable
Installing ADB
Ubuntu/Debian:
sudo apt update
sudo apt install android-tools-adb
macOS:
brew install android-platform-tools
Windows: Download from Android Developer website
Scripts Overview
🚀 push.sh - Push files to Android
Transfer files from your computer to your Android device.
Usage:
# Interactive mode (recommended)
./push.sh
# Direct mode
./push.sh ~/Documents/file.pdf /sdcard/Download/
./push.sh ~/Pictures/vacation/ /sdcard/Pictures/
Features:
- Interactive mode with common destination suggestions
- Automatic path validation
- Directory creation if needed
- Progress feedback
- Support for both files and directories
📥 pull.sh - Pull files from Android
Transfer files from your Android device to your computer.
Usage:
# Interactive mode (recommended)
./pull.sh
# Direct mode
./pull.sh /sdcard/DCIM/Camera/ ~/Pictures/phone-backup/
./pull.sh /sdcard/Download/document.pdf ~/Downloads/
Features:
- Browse Android filesystem interactively
- Quick access to common folders
- File count and size summary
- Creates destination directories automatically
- Support for both files and directories
📱 adb-transfer.sh - All-in-One Menu
Interactive menu system for all file transfer operations.
Usage:
./adb-transfer.sh
Features:
- Device status and information display
- Quick actions (backup photos, screenshots, WhatsApp media)
- Access to push/pull scripts
- Device information viewer
- Beautiful CLI interface
Common Android Paths
/sdcard/Download/- Downloads folder/sdcard/DCIM/Camera/- Camera photos and videos/sdcard/Pictures/- General pictures folder/sdcard/Screenshots/- Screenshots (varies by device)/sdcard/WhatsApp/Media/- WhatsApp media files/sdcard/Documents/- Documents folder/sdcard/Music/- Music files/sdcard/Movies/- Video files
Making Scripts Executable
First time setup:
chmod +x push.sh pull.sh adb-transfer.sh
Examples
Backup all camera photos
./pull.sh /sdcard/DCIM/Camera/ ~/Pictures/android-backup/
Push multiple PDFs to Downloads
./push.sh ~/Documents/*.pdf /sdcard/Download/
Interactive file browser
./pull.sh
# Then select option 1 to browse filesystem
Quick backup using menu
./adb-transfer.sh
# Select option 3 for quick actions
# Select option 1 to backup all camera photos
Troubleshooting
"No device connected" error
- Check USB cable connection
- Enable USB debugging: Settings → Developer options → USB debugging
- Accept the authorization prompt on your phone
- Try
adb devicesto verify connection
"Permission denied" errors
- Some system directories require root access
- Stick to
/sdcard/paths for normal usage
Slow transfer speeds
- Use USB 3.0 ports and cables when possible
- Large files/directories take time - the scripts show progress
Tips
- Use interactive mode - It's easier and prevents typos
- Backup regularly - Use the quick actions menu for easy backups
- Check free space - Use device info option to see available storage
- Organize transfers - The scripts create timestamped folders for backups