Skip to main content
Android File Synchronization:

Sync files with Android using adb

Summary

Use adb to sync files between your computer and Android device faster and more reliably than MTP. Learn push, pull, and rsync with examples.

Introduction #

The Android Debug Bridge (adb) is a command-line tool included with the Android Software Development Kit (SDK). It allows you to communicate directly with your Android device from your computer. One of its practical uses is synchronizing files between your computer and an Android device.

Why abd it is preferred over MTP #

The Android Debug Bridge communicates directly over the Android Debug Interface, using the same connection as USB debugging. Unlike Media Transfer Protocol (MTP), which relies on a filesystem translation layer, adb accesses files through the Android operating system itself. This method eliminates file naming restrictions, broken transfers, and slow directory scans that are common with MTP on some systems.

For users who regularly transfer large data sets or entire media collections, adb provides a faster and scriptable solution that integrates well with command-line workflows.

Android internal storage paths #

When synchronizing files, it is important to understand how Android organizes internal storage. The apparent “internal storage” is usually a user-accessible part of the filesystem that may be presented differently across devices.

Most modern Android devices use the following paths:

  1. /storage/emulated/0/ — the actual directory representing the primary user’s storage area.
  2. /sdcard/ — a symbolic link (symlink) pointing to /storage/emulated/0/. This is the most common path used in commands.
  3. /storage/self/primary/ — another path that refers to the same storage for the currently active user.
  4. /mnt/sdcard/ — legacy path on older Android versions.

Universal target path: When using adb commands, you can safely use /sdcard/ as a universal target path.

Syncing with adb push #

The adb push command copies files or directories from your local computer to the Android device. You can specify absolute or relative paths. If the destination path does not exist, adb creates it automatically. You can push entire directories or just the contents of one.

Synopsis #

adb push [local] [remote]

Examples #

Push local ~/Music/ directory #

adb push ~/Music/ /sdcard/Music/

This command copies the entire Music directory from your local home folder to the Android device’s /sdcard/Music/ directory. All subdirectories and files will be transferred recursively.

Push local ~/Pictures/2025/ directory #

adb push ~/Pictures/2025/ /sdcard/Pictures/2025/

This command transfers all photos from the 2025 folder on your computer into the same path on the Android device. If the target directory does not exist, it is created automatically.

Push only the contents of ~/Videos/memes/ #

adb push ~/Videos/memes/* /sdcard/Movies/memes/

This command pushes only the files and subdirectories inside ~/Videos/memes/, not the directory itself, into /sdcard/Movies/memes/. The destination directory must already exist.

Syncing with adb pull #

The adb pull command retrieves files or directories from the Android device to your computer. The destination can be any local directory with appropriate permissions. Like adb push, this command recursively copies directories and files.

Synopsis #

adb pull [remote] [local]

Examples #

Pull Android Music directory #

adb pull /sdcard/Music/ ~/Music/

This copies all files and subdirectories from the device’s /sdcard/Music/ directory into your local ~/Music/ folder.

Pull Android Pictures/2025/ directory #

adb pull /sdcard/Pictures/2025/ ~/Pictures/2025/

This retrieves all pictures from the device’s Pictures/2025/ directory and saves them into your local ~/Pictures/2025/ directory.

Pull only contents from Android Videos/memes/ #

adb pull /sdcard/Movies/memes/* ~/Videos/memes/

This command copies only the files and folders inside /sdcard/Movies/memes/ to your local ~/Videos/memes/ directory, without creating an extra subfolder.

Syncing with adb and rsync #

For users who need to synchronize large directories frequently, combining adb with rsync provides an incremental, bandwidth-saving solution. The idea is to mount the Android filesystem temporarily through adb and then run rsync to mirror changes.

The following example demonstrates a basic rsync-based synchronization script:

#!/bin/bash
# Sync local ~/Music/ to Android /sdcard/Music/ using adb and rsync

# Define temporary mount points
ADB_MOUNT=/tmp/android-music
mkdir -p "$ADB_MOUNT"

# Use adb to pull a directory listing and sync changes
adb shell mkdir -p /sdcard/Music/
adb pull /sdcard/Music/ "$ADB_MOUNT/"

# Use rsync to compare and push changes
rsync -av --delete ~/Music/ "$ADB_MOUNT/"

# Push updated files back to Android
adb push "$ADB_MOUNT/" /sdcard/Music/

# Clean up
rm -rf "$ADB_MOUNT"

This script performs the following steps:

  1. Creates a temporary directory on the computer for comparison.
  2. Pulls the current /sdcard/Music/ contents from the Android device.
  3. Uses rsync to synchronize local and pulled directories, identifying additions, deletions, and modifications.
  4. Pushes the updated contents back to the Android device.
  5. Removes the temporary directory afterward.

While adb alone is suitable for single transfers, combining adb with rsync enables a practical way to perform incremental synchronization without relying on networked file systems or external apps.

Have a look at our rsync cheat sheet for a variety of rsync options.

FAQ's #

Most common questions and brief, easy-to-understand answers on the topic:

What is adb?

The Android Debug Bridge (adb) is a command-line tool that allows you to communicate with an Android device from a computer for debugging, file transfer, and shell access.

Why is adb better than MTP for large file transfers?

adb transfers files directly over the device’s debug connection without relying on the Media Transfer Protocol (MTP), avoiding connection drops and file size limits.

Where are user files stored on Android?

User files are typically stored in /sdcard/, which is a symlink to /storage/emulated/0/ on most Android devices.

Do I need root access to use adb for file transfer?

No, you only need USB debugging enabled on your Android device to use adb for pushing and pulling files.

Can adb work wirelessly?

Yes, adb can connect over Wi-Fi using adb tcpip and adb connect, though USB is more stable for large file transfers.

Further readings #

Sources and recommended, further resources on the topic:

Author

Jonas Jared Jacek • J15k

Jonas Jared Jacek (J15k)

Jonas works as project manager, web designer, and web developer since 2001. On top of that, he is a Linux system administrator with a broad interest in things related to programming, architecture, and design. See: https://www.j15k.com/

License

Sync files with Android using adb by Jonas Jared Jacek is licensed under CC BY-SA 4.0.

This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:

<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/sync-files-with-android-using-adb">Sync files with Android using adb</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>

For more information see the Ditig legal page.

All Topics

Random Quote

“I don't mind looking like a human being instead of a tie+shirt robot.”

Linus Torvalds  Finnish software engineer, creator of the Linux kernel and GitLinux Journal, - IT quotes