generated from nhcarrigan/template
150 lines
3.6 KiB
Markdown
150 lines
3.6 KiB
Markdown
# 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:**
|
|
```bash
|
|
sudo apt update
|
|
sudo apt install android-tools-adb
|
|
```
|
|
|
|
**macOS:**
|
|
```bash
|
|
brew install android-platform-tools
|
|
```
|
|
|
|
**Windows:**
|
|
Download from [Android Developer website](https://developer.android.com/studio/releases/platform-tools)
|
|
|
|
## Scripts Overview
|
|
|
|
### 🚀 push.sh - Push files to Android
|
|
Transfer files from your computer to your Android device.
|
|
|
|
**Usage:**
|
|
```bash
|
|
# 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:**
|
|
```bash
|
|
# 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:**
|
|
```bash
|
|
./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:
|
|
```bash
|
|
chmod +x push.sh pull.sh adb-transfer.sh
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Backup all camera photos
|
|
```bash
|
|
./pull.sh /sdcard/DCIM/Camera/ ~/Pictures/android-backup/
|
|
```
|
|
|
|
### Push multiple PDFs to Downloads
|
|
```bash
|
|
./push.sh ~/Documents/*.pdf /sdcard/Download/
|
|
```
|
|
|
|
### Interactive file browser
|
|
```bash
|
|
./pull.sh
|
|
# Then select option 1 to browse filesystem
|
|
```
|
|
|
|
### Quick backup using menu
|
|
```bash
|
|
./adb-transfer.sh
|
|
# Select option 3 for quick actions
|
|
# Select option 1 to backup all camera photos
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### "No device connected" error
|
|
1. Check USB cable connection
|
|
2. Enable USB debugging: Settings → Developer options → USB debugging
|
|
3. Accept the authorization prompt on your phone
|
|
4. Try `adb devices` to 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
|
|
|
|
1. **Use interactive mode** - It's easier and prevents typos
|
|
2. **Backup regularly** - Use the quick actions menu for easy backups
|
|
3. **Check free space** - Use device info option to see available storage
|
|
4. **Organize transfers** - The scripts create timestamped folders for backups
|
|
|
|
## Created with 💕 by Naomi & Hikari |