Takeout JSON
EN

Sort Android Photos into Folders by Year and Month

DCIM/Camera on an Android phone holds thousands of photos in one folder. How to sort them into Year and Month folders on the phone, without losing dates or breaking the gallery.

To sort the photos on an Android phone into Year and Month folders, create folders such as DCIM/Camera/2024/07 and move each photo into the folder of the month it was taken. A file manager app can do it for a few photos. For a whole camera folder, do it from a computer with adb, which moves files on the phone without copying them and without changing their dates.

Does the gallery care?

Not for sorting. The gallery orders photos by date, wherever they are. Folders matter in three other places:

  • Albums. Most galleries show each folder under DCIM and Pictures as an album. Year folders give you an album per year.
  • The computer. When you open the phone from a computer, one folder with 8,000 files is slow to open and hard to browse.
  • Backup. Google Photos backs up the folders you choose. Subfolders of DCIM/Camera are included with it.

Where it is safe to sort

Sort inside DCIM or Pictures. Avoid Android/data and Download; some galleries skip them.

Moving photos out of DCIM/Camera into another folder can stop Google Photos from backing them up, unless you also turn on backup for that folder. Subfolders inside DCIM/Camera keep the camera backup.

With a file manager app

Select the photos of one month, choose Move, create the folder, confirm. Fine for a month or two. For years of photos, use a computer.

From a computer with adb

With USB debugging on:

adb shell mkdir -p /sdcard/DCIM/Camera/2024/07
adb shell mv -n /sdcard/DCIM/Camera/IMG_202407*.jpg /sdcard/DCIM/Camera/2024/07/

The second line uses the date in the camera's file names. That covers photos named IMG_YYYYMMDD_.... Photos named differently, such as PXL_... on Pixels or saved images, need their date taken read from inside the photo. For a whole library, a script on the computer writes one mv line per photo and runs them on the phone in one go.

mv within the phone keeps the file date, so the gallery does not move anything. Afterwards:

adb shell content call --uri content://media/ --method scan_volume --arg external_primary

Which layout?

  • Year / Month (2024/07): the most common. Numbers sort the same in every language.
  • Year / Place (2024/Lisbon): good for travel. Photos without GPS stay in the year folder.
  • Year-Month (2024-07): one level, easy to scroll.

More on the choice in how to organize photos by year and month folders.

With the app

Photo Date & Metadata Fixer's Android Phone tab, which is Windows only, has a Re-folder on phone tab. Pick a folder on the phone and a layout (Year / Month, Year / Place, Country / City and more). The app reads every photo's date and place from the phone, shows where each one would go, and then moves them on the phone itself.

The Android Phone tab in Photo Date & Metadata Fixer for Windows: Folders to phone, Takeout to phone, .zip & archives, Rename on phone and Re-folder on phone

It never overwrites, sets wrong file dates to the date taken while it is at it, removes the folders it emptied, and Undo moves everything back.

Frequently asked questions

Will Google Photos upload the photos again after moving?

No. Google Photos recognizes photos it already backed up, even in a new folder.

Can I sort photos on the SD card?

Yes. The card is under /storage/<card id>/ instead of /sdcard/. adb shell ls /storage shows its id.

What about videos?

They move the same way. A video's date comes from inside the video, or from its name and file date.