Skip to content

Backup and organize your Android media files in Windows.

Notifications You must be signed in to change notification settings

JosePartal/MediaManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“± Android Media Pull & Sort Script

This script pulls photos and videos from an Android device using ADB and automatically sorts them into organized year/month folders on your computer.

It collects media from common Android folders (Camera, Instagram, WhatsApp, etc.), extracts the correct date, and moves files into a structured archive.


πŸš€ What It Does

  1. Connects to your Android device via ADB

  2. Pulls media from predefined Android folders

  3. Automatically detects additional subfolders inside:

    /sdcard/Pictures/Gallery/owner
    
  4. Extracts the correct date using:

    • πŸ“· EXIF DateTimeOriginal (for real camera photos)
    • πŸ“ WhatsApp filename patterns (e.g.Β IMG-20240212-WA0001.jpg)
    • πŸ•’ File modification date (fallback)
  5. Sorts files into:

<!-- -->
DESTINATION/
    β”œβ”€β”€ 2023/
    β”‚     β”œβ”€β”€ 11/
    β”‚     β”œβ”€β”€ 12/
    β”œβ”€β”€ 2024/
          β”œβ”€β”€ 01/
          β”œβ”€β”€ 02/
  1. Avoids duplicate files\
  2. Cleans up the temporary folder when finished

πŸ“¦ Requirements

  • Python 3.8+
  • ADB (Android Debug Bridge) installed and available in PATH
  • Android device with USB debugging enabled
  • Python package:
    • Pillow

Install Pillow:

pip install pillow

βš™οΈ Configuration

Create a config.py file in the same directory with:

TEMP_FOLDER = "temp_media"
DESTINATION = "sorted_media"
  • TEMP_FOLDER β†’ where files are temporarily pulled
  • DESTINATION β†’ final sorted archive location

πŸ“‚ Android Folders Pulled

The script pulls media from:

  • /sdcard/DCIM/Camera
  • /sdcard/Movies/Instagram
  • /sdcard/Pictures/Instagram
  • /sdcard/Pictures/Whatsapp
  • /sdcard/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Images
  • /sdcard/Android/media/com.whatsapp/WhatsApp/Media/WhatsApp Video
  • /sdcard/Pictures/Gallery/owner (including all subfolders)

You can modify BASE_ANDROID_SOURCES inside the script if needed.


▢️ Usage

  1. Connect your Android device via USB
  2. Enable USB debugging
  3. Verify connection:
adb devices
  1. Run the script:
python pull_and_sort_media.py

🧠 Date Detection Logic

The script determines the file date in this order:

  1. EXIF metadata (DateTimeOriginal)
  2. WhatsApp filename date (YYYYMMDD)
  3. File modification timestamp

This ensures accurate sorting even for shared media.


🧹 Cleanup

After sorting is complete, the temporary pull folder is automatically deleted.


πŸ›‘ Duplicate Protection

If a file already exists in the destination folder, it will be skipped.


πŸ“Œ Notes

  • Only processes:
    • .jpg
    • .jpeg
    • .png
    • .mp4
    • .mov
  • Files are moved (not copied) after sorting.
  • Designed for personal media archiving and cleanup.

About

Backup and organize your Android media files in Windows.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages