Skip to content

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