Metadata-Version: 2.4
Name: adbackup
Version: 1.0.0
Summary: Backs up photos and videos from an Android phone over adb - copies only what's missing and keeps the real capture dates.
Project-URL: Homepage, https://github.com/EmilHaase/adbackup
Project-URL: Repository, https://github.com/EmilHaase/adbackup
Project-URL: Issues, https://github.com/EmilHaase/adbackup/issues
Author: Emil Haase
License: MIT
License-File: LICENSE
Keywords: adb,android,backup,dcim,exif,photos
Classifier: Environment :: Console
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: System :: Archiving :: Backup
Requires-Python: >=3.9
Requires-Dist: exifread>=3.0
Requires-Dist: hachoir>=3.1
Requires-Dist: pillow-heif>=0.13
Requires-Dist: pillow>=10.0
Requires-Dist: prompt-toolkit>=3.0.36
Requires-Dist: rich>=13.0
Description-Content-Type: text/markdown

# 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:

```powershell
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.
