Moving photos, logs, or APKs between your Android phone and a PC can feel clunky when you rely on Bluetooth, cloud sync, or USB‑MTP mode. ADB (Android Debug Bridge) offers a fast, scriptable, and root‑free way to copy files in either direction. This guide shows you exactly how to set up ADB, use the push and pull commands, and troubleshoot the most common hiccups.
Build number seven times, then Settings > System > Developer options > toggle USB debugging on.platform-tools zip for your OS.C:\adb on Windows or ~/adb on macOS/Linux.PATH so you can run adb from any terminal. On Windows, edit Environment Variables → Path. On macOS/Linux, add export PATH=$PATH:~/adb to ~/.bash_profile or ~/.zshrc.adb version. You should see a version string like Android Debug Bridge version 1.0.41.adb devices. The first time you do this, the phone will show a prompt “Allow USB debugging?” – tap Allow. You may also check Always allow from this computer to avoid future prompts.device, the link is ready. Example output:
List of devices attached 1234567890ABCDEF device
unauthorized, re‑grant permission on the phone or reconnect the cable.ADB sees the Android file system as a set of logical partitions:
/sdcard (or /storage/emulated/0) – the primary shared storage visible to the user and most apps. This is where photos, downloads, and music live./data – private app data. Access requires root; you will not be able to push/pull here without it./system – the read‑only system partition.For most file‑transfer needs, you’ll work inside /sdcard. The path you use in ADB commands must match the device’s case‑sensitive layout.
/sdcard/Pictures/Vacation/photo1.jpg.C:\Users\Me\Downloads\android‑files (Windows) or ~/Downloads/android‑files (macOS/Linux).adb pull /sdcard/Pictures/Vacation/photo1.jpg "C:\Users\Me\Downloads\android‑files"(On macOS/Linux replace the Windows path with
~/Downloads/android‑files.)If you need a whole directory, add the -a flag to preserve timestamps and use the folder path as the source:
adb pull -a /sdcard/Download "C:\Users\Me\Downloads\android‑files\Download"
The command copies every file recursively. Be aware that large folders can take several minutes.
C:\Users\Me\Desktop\report.pdf./sdcard/Download so you can open it from the device’s Downloads app.adb push "C:\Users\Me\Desktop\report.pdf" /sdcard/Download/
ADB does not accept wild‑cards directly, but you can push a whole folder:
adb push "C:\Users\Me\Music\MyPlaylist" /sdcard/Music/
This copies the MyPlaylist directory and all its contents into the device’s Music folder.
If you’re unsure of a file’s exact location, you can explore the device with an interactive shell:
adb shell
Then use typical Linux commands:
ls -l /sdcard/ – list top‑level directories.cd /sdcard/Pictures – change directory.pwd – print the current path (useful for confirming case).exit – leave the shell.This step is optional but saves time when you’re dealing with obscure app‑specific folders.
ADB can only write to /sdcard and other world‑readable locations. If you try to push to /data or /system, you’ll see:
error: failed to copy '/path/to/file' to '/data/...': Permission denied
Solution: Stick to /sdcard or use a rooted device (outside the scope of this guide).
This usually means the USB debugging handshake failed.
udev rules (Linux) – install android-sdk-platform-tools from your distro’s repository.ADB may succeed but place the file in a different folder if you omitted quotes around a path containing spaces.
Always wrap Windows paths in double quotes, e.g., "C:\My Docs\file.txt".
Possible causes:
Once you’re comfortable with the basic commands, you can script them. Below is a simple batch file for Windows that backs up a chosen folder from the phone to your PC every night:
:: backup_phone_photos.bat @echo off set SRC=/sdcard/Pictures set DST=C:\Backups\Phone\Pictures adb pull -a %SRC% %DST% if %errorlevel% neq 0 ( echo Transfer failed – check device connection. ) else ( echo Backup completed at %date% %time% )
Save the file, double‑click to run, or schedule it with Task Scheduler. macOS/Linux users can create a similar shell script and add it to cron.
PATH only for this task, you can leave it – it’s harmless. Otherwise, remove it from Environment Variables if you prefer a cleaner system.| Issue | Check | Fix |
|---|---|---|
| Device not listed | Run adb devices and look for unauthorized | Accept the debugging prompt on the phone; try a different cable. |
| Permission denied | Target path outside /sdcard | Use a folder under /sdcard or root the device. |
| Transfer stalls | USB cable type / port speed | Switch to a certified data cable and a USB 3.0 port. |
| File not where expected | Quotes around paths with spaces | Wrap Windows paths in double quotes; verify case‑sensitivity on Android. |
ADB shines when you need:
/sdcard that file managers may hide.For occasional single‑file moves, the built‑in USB‑MTP mode or cloud services (Google Drive, OneDrive) are more user‑friendly. However, ADB remains the most reliable tool when the device’s UI is unresponsive or when you’re working on a headless device (e.g., a development board).
With the steps above, you can now copy any file to or from your Android phone quickly, safely, and without rooting. Whether you’re backing up screenshots, pulling log files for a bug report, or loading a new e‑book onto your device, ADB’s push/pull commands give you precise control over the transfer process.









