Skip to main content

Backs up photos and videos from an Android phone over adb - copies only what's missing and keeps the real capture dates.

Project description

ADBackup

Actually a good way to back up photos and videos from an Android phone to your PC over ADB, keeping the real capture date on each file.

Why

It always annoyed me that there's no proper way to sync photos and videos off a phone with adb. adb pull makes you download everything again, adb sync throws away the picture capture dates, and either way you're typing out commands by hand every time. So I made this: point it at a folder, pick what you want, and it copies only what's missing and fixes the dates afterwards.

Your phone is only ever read from - ADBackup never deletes, moves, or renames anything on it.

Using it

  1. cd into the folder where you want the files saved.
  2. Plug in your phone with USB debugging on.
  3. Run adbackup.

It finds the phone (approve the debugging prompt if it asks), then shows a little folder browser, DCIM is at the top, folders above files. Move with the arrow keys, Enter to open a folder, Backspace to go up, S to pick the folder you're in, Q to quit.

Then it asks a few things (arrows + Enter): include subfolders, update or redownload everything, correct the dates, and how many files to copy at once (just press Enter for 4). It shows how many are new vs already backed up, you confirm, and it copies them with a progress bar and stamps each file's Created/Modified date to when the photo or video was actually taken.

The folder you picked is recreated by name in your destination, e.g. picking /storage/emulated/0/DCIM/Camera gives you a Camera\ folder.

Installing

You need ADB on your PATH (Android platform-tools - check with adb version) and USB debugging enabled on the phone. Then:

py -m pip install --user pipx
py -m pipx ensurepath      # then open a new terminal
pipx install adbackup

pipx ensurepath puts the adbackup command on your PATH, so after that it just works from any folder.

Latest from source instead: pipx install git+https://github.com/EmilHaase/adbackup.git

Speed

Files are pulled in batches of up to 100 per adb process instead of one command per file, so transfer time isn't eaten by process startup. Every file is still size-verified and retried individually if needed. Live speed and ETA are shown in the progress bar.

I recommend using a good USB 3 cable - with one I usually get about 250 MB/s. Of course lots of smaller files download slower than a small amount of big ones, since each file has a fixed per-file cost.

Disclaimer

I have to apologise for a limitation I could not work around: photos and videos taken before January 1, 1601 cannot be dated correctly. Windows file timestamps simply do not go back any further, and there is nothing I can do about it. Files with a capture date before 1601 are treated as having no readable date - if you picked the option to move such files, they will be sorted into the _ADBackup_errors folder and you will unfortunately have to date them manually. I am genuinely sorry to everyone affected by this.

Notes

  • Dates come from EXIF for images (JPEG, HEIC, RAW, …) and the container creation time for videos. If a file has no readable date you choose up front what happens - keep it with the file's own date, move it to an _ADBackup_errors folder, or skip it. Nothing is ever removed from the phone.
  • Anything skipped or failed is listed at the end and written to _ADBackup_report.txt in the destination.
  • Re-running is safe: in update mode it skips whatever's already there.
  • Edge cases are handled: filenames Windows doesn't allow are renamed safely (and still recognized on re-runs), and paths longer than Windows' 260-char limit work fine.

About

Thought up by me, Emil, and yes, even the the cool name. The actual code was writen with Claude (Opus 4.8 and Fable 5) and tested it properly myself - I actually use it. MIT licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adbackup-1.0.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adbackup-1.0.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file adbackup-1.0.0.tar.gz.

File metadata

  • Download URL: adbackup-1.0.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for adbackup-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cd6167a79cf5e6d3f3a2fedac16482ef556950b21b8fbc9106bf92b59cbebe16
MD5 a38a87b270f32841122f10f969100955
BLAKE2b-256 10362151b86da0452c5bf52ae900b06d8e974fa168c98aea2c614fd3d90c2f41

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbackup-1.0.0.tar.gz:

Publisher: publish.yml on EmilHaase/adbackup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adbackup-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: adbackup-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for adbackup-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f05aa7717868b9b87e99d08b02005bff881b3d4a9326d8bd60f43a5e2fb44e1f
MD5 83166b9af92e54328529861cd7f1baca
BLAKE2b-256 d469a8ddcf1fc0a425d20a8f08a9c4ed36e5e0e978cb9949330521477844df06

See more details on using hashes here.

Provenance

The following attestation bundles were made for adbackup-1.0.0-py3-none-any.whl:

Publisher: publish.yml on EmilHaase/adbackup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page