How to Sort Photos into Folders Automatically

Three methods compared — from built-in OS tools to command-line scripts to AI-powered event detection.

You can automatically sort photos into folders using three main approaches: Windows File Explorer or Mac Finder for basic date sorting, command-line scripts (ExifTool, Python) for more control without extra software, and AI-powered photo organizers that create meaningful event-named folders automatically. The fastest and most intelligent method for large, unorganized libraries is the AI approach — it takes dates, GPS data, and image content into account to produce folder names like "2025/07-Portugal" rather than just "2025/07/15".

Why Automatic Photo Sorting Matters

The scale of the problem has grown enormously. According to industry research, the average smartphone user now takes over 3,000 photos per year. Add in photos from a partner, family events, vacations shot on a dedicated camera, and video clips from various devices, and a typical household accumulates 5,000–8,000 new media files every year. Over a decade, that is 50,000–80,000 files.

Manual sorting of that volume — selecting files, creating folders, dragging and dropping — takes an estimated 15–20 hours for a 10,000-photo library. Few people actually do it. The result is a "camera roll" mentality applied to the desktop: one enormous folder (or a handful of vaguely named folders) containing years of photos with no meaningful structure.

This matters practically in several ways:

  • Finding specific photos takes minutes instead of seconds. With no folder structure, you rely entirely on search, which requires remembering a keyword, or scrolling, which is impractical at scale.
  • Sharing becomes difficult. If someone asks for "all the photos from the camping trip in 2024," you have to manually hunt and gather rather than just opening a folder.
  • Backup and archiving are harder to reason about. With a structured library, you can backup by year or confirm at a glance that 2023 is fully archived. With a flat library, you are always unsure what you have and what you do not.

Automatic sorting removes the time cost and the procrastination barrier. You point a tool at your photo dump, it creates the folder structure, and your library is organized.

Method 1: Windows File Explorer / Mac Finder

Both Windows and Mac have rudimentary built-in sorting that can help you create a date-based folder structure manually. This is the lowest-friction starting point if you need zero additional tools, but it has significant limitations.

On Windows

Open File Explorer and navigate to your photo folder. Switch to the "Details" view (View → Details), then click the "Date taken" column header to sort all photos chronologically. You can now see photos grouped by date visually, which makes it easier to select groups and move them into folders you create manually.

Windows also offers a "Group by → Date taken" option (right-click in the folder) which collapses photos into date groups. This is useful for getting an overview of how many photos you have in each time period.

What it cannot do: Windows File Explorer cannot create folders automatically, cannot detect events, and cannot batch-move files into a structured hierarchy. Everything is still manual — the built-in sorting just makes the manual work slightly faster.

On Mac

Mac Finder's built-in photo handling is similarly limited. You can sort by Date Created in list view, but macOS does not distinguish between "date taken" (EXIF) and "date created" (filesystem), which can produce incorrect ordering for files that were copied or downloaded.

The Mac Photos app (separate from Finder) automatically organizes imported photos by Year, Month, and Day in its own internal library, but this library is not an accessible folder structure on disk — the files are stored in an opaque package format. You cannot use Mac Photos to produce a portable, Finder-visible Year/Month-Event hierarchy.

When this method makes sense

Built-in OS tools are appropriate when you have a small batch (under 200 photos), you already know what events are represented, and you are willing to create and populate folders manually. For anything larger, the next two methods are significantly faster.

Method 2: Using Command-Line Scripts

For users comfortable with a terminal, command-line tools can automate the folder-creation-and-sorting step entirely. This method is free, flexible, and can handle very large libraries, but it requires some technical comfort and produces only date-based folders — not event-named ones.

ExifTool

ExifTool is the most reliable command-line tool for reading and writing photo metadata across all formats. A single ExifTool command can sort an entire library by date taken into a Year/Month folder structure:

exiftool -r -d "/output/%Y/%m" \
  "-Directory<DateTimeOriginal" \
  -ext jpg -ext heic -ext png \
  /path/to/unsorted-photos/

This command reads the DateTimeOriginal EXIF field from every matching file and copies it into a Year/Month directory structure under "/output". The -r flag makes it recursive, so it processes subdirectories as well. ExifTool is available free for Windows, Mac, and Linux from exiftool.org.

Limitations: ExifTool creates folders by date only — "2024/07" rather than "2024/07-Portugal". It cannot detect what the photos show. For travel, events, or parties, you still need to rename the folders manually after sorting. It also does not handle photos with no EXIF data gracefully by default.

Python scripts

Python with the Pillow and piexif libraries gives you full control over sorting logic. You can write scripts that read EXIF, parse GPS coordinates (reverse-geocoding to a place name), and create location-based folders. The downside is development time — a robust photo sorting script that handles edge cases (missing EXIF, duplicate filenames, RAW files) takes several hours to write and test properly.

Several open-source photo sorting scripts exist on GitHub. Search for "python photo organize exif" to find maintained options. Before running any community script on your originals, test it on a copy of 50–100 photos first.

When this method makes sense

Command-line tools are the right choice for technical users who want full control, need to process large batches on a server or NAS, or want to integrate photo sorting into a larger automation pipeline. For most home users, the learning curve is not worth it compared to a dedicated tool.

Method 3: AI-Powered Photo Sorters

AI-powered photo sorters go beyond date-only sorting to produce the kind of meaningful folder names a human would choose. Instead of just reading the EXIF date, they analyze photo content, GPS data, and temporal clusters to name folders after what is actually in the photos.

The result is a folder structure like:

Photos/
├── 2025/
│   ├── 03-Home/
│   ├── 06-Barcelona-Trip/
│   ├── 08-Wedding-Anna-Marco/
│   └── 12-Christmas-Family/
└── 2026/
    ├── 01-New-Year/
    └── 03-Weekend-Hike/

This is the structure you would build manually if you had infinite time — and AI tools can produce it in minutes.

PhotoSort is one of the leading tools in this category. What distinguishes it from cloud-based AI photo tools is that the AI model runs locally in your browser — your photos are never uploaded anywhere. It uses the CLIP model (Contrastive Language-Image Pre-training), which can match images to semantic descriptions, enabling it to recognize event types like weddings, concerts, and outdoor trips from image content alone, not just metadata.

Step-by-Step: Sort Photos Automatically with PhotoSort

Here is a complete walkthrough of sorting a photo library automatically using PhotoSort. The process takes 5–15 minutes of active time for most libraries, with additional processing time depending on library size and your computer's speed.

Before you start

PhotoSort requires Chrome or Edge — it uses the File System Access API, which is only available in Chromium-based browsers. Firefox and Safari do not support this API. Make sure you are on a recent version of Chrome or Edge.

On first use, PhotoSort downloads its AI model (~350MB). This is a one-time download; the model is cached in your browser and all subsequent sessions run fully offline. Plan for this initial download if you are on a slow connection.

Step 1: Open PhotoSort and select your folder

Navigate to photosort.app and click "Get Started." You will be prompted to select a folder. Click the folder selector and point it at the folder containing your unsorted photos. PhotoSort can handle nested folders — you do not need to flatten everything first.

Step 2: Enter your home city

PhotoSort asks for your home city (e.g., "Berlin" or "Chicago"). This is used to distinguish between photos taken near home — which get filed as home sessions or local events — and photos taken in other locations, which get identified as trips. Without this, a weekend at home and a vacation in another country might be treated the same way.

Step 3: Run the analysis

Click "Analyze Photos." PhotoSort reads the EXIF data from every file, extracts GPS coordinates where available, and passes a selection of images through the CLIP model to identify content. The progress bar shows how many files have been processed. For a library of 5,000 photos on a modern laptop, expect roughly 8–12 minutes.

Step 4: Review the proposed folder structure

When the analysis is complete, PhotoSort presents a preview of the proposed folder structure. You can see each suggested folder name, the number of photos it contains, and thumbnail previews. This is the time to:

  • Rename any folders whose auto-generated names are not quite right
  • Merge two event folders that should be one (e.g., if a multi-day event was split)
  • Exclude photos you do not want in the sorted output

See How It Works for a detailed explanation of the naming algorithm.

Step 5: Select the output folder and confirm

Choose where the sorted library should be written — this can be the same drive or a different one. Click "Sort Photos." PhotoSort copies all files into the new Year/Month-EventName structure. Your originals are not touched.

Step 6: Verify and clean up

Open the output folder and spot-check a few event folders. Confirm the file counts look right and the contents match the folder names. Once you are satisfied, you can safely delete the originals from the unsorted source folder if desired.

What Happens to Your Original Photos?

This is the most important safety question in any photo sorting workflow, and the answer varies critically between tools.

PhotoSort operates on a copy-only, non-destructive principle: it creates copies of your photos in the new folder structure and never touches the originals. Your source folder remains exactly as it was before you ran the analysis. This means:

  • If something goes wrong (power cut, bug, unexpected result), your photos are not lost.
  • You can re-run the analysis with different settings without consequence.
  • You decide when (and whether) to delete the originals — PhotoSort does not make that decision for you.

Some other tools, particularly command-line scripts written by third parties, perform move operations rather than copies. Moving is faster but risky: if the process is interrupted, files can end up partially moved with no originals to fall back on. Always verify that any tool you use copies rather than moves, and always work on a backup copy of your library the first time you try a new tool.

Tips for Batch Sorting Large Photo Libraries

Processing 10,000 or 50,000 photos has some practical considerations that smaller batches do not.

Process by year if the library is very large

If you have 40,000 photos spanning fifteen years, sorting the entire library in one session will take several hours and requires significant RAM. Consider breaking the job into annual batches: sort 2020 photos first, review, confirm, then move to 2021. This also makes it easier to catch errors early.

Keep the output drive local

Writing tens of thousands of files to a network drive or NAS over WiFi is orders of magnitude slower than writing to a local SSD or even a USB 3.0 drive. If your library lives on a network location, copy it locally for the sorting process and transfer the organized output back afterward.

Close other applications

AI photo analysis is CPU and memory intensive. Close video players, browsers with many tabs, and other heavy applications while PhotoSort is processing. On a laptop, plug in the power adapter — sustained CPU workloads drain batteries quickly and some computers throttle CPU speed when running on battery.

Handle duplicates before sorting

Large libraries accumulated over many years often contain duplicates — the same photo imported twice from different devices, or backed up in multiple places. Sorting duplicates creates cluttered output folders with two identical files. Run a duplicate finder (like dupeGuru, which is free and cross-platform) on your source folder before the sorting step.

Use a staging area

Designate a specific folder as your "to be sorted" inbox. Whenever you import photos from your phone or camera, dump them into the inbox rather than directly into the organized structure. Run sorting on the inbox monthly. This keeps the sorting job small and manageable rather than letting a backlog build.

Frequently Asked Questions

Can I automatically sort photos that have no EXIF date?

Yes, with caveats. When EXIF date data is missing (common in old scanned photos, screenshots, and images downloaded from the web), most tools fall back to the filesystem creation or modification date. This is often inaccurate — the file date changes when you copy or download a file. PhotoSort groups photos without EXIF dates separately so you can assign them manually. For scanned photos, you can add EXIF dates in bulk using ExifTool before running the AI sorter.

Will sorting photos affect the originals?

PhotoSort never modifies or moves originals — it only creates copies in the output folder. However, not all tools work this way. Always check the documentation of any tool you use. As a general safety rule, make a backup of your entire photo library before running any bulk operation for the first time.

Can I automatically sort videos as well as photos?

Yes. PhotoSort supports MP4, MOV, AVI, MKV, and M4V video files in addition to image formats. Videos are sorted using their embedded metadata (creation date, GPS where available) and grouped with nearby photos from the same time window. The full list of supported formats is on the Features page.

Does automatic sorting work on a Mac?

PhotoSort is browser-based and runs in Chrome or Edge on both Windows and Mac. The Mac version of Chrome supports the File System Access API fully. Note that some file types (particularly HEIC from iPhone) are handled natively on Mac but may require additional codec support on Windows — PhotoSort handles HEIC decoding internally regardless of platform.

How accurate is the AI event detection?

Event detection accuracy depends on photo content and metadata availability. When GPS data is present, location-based naming (trips, cities) is very accurate. For content-based event detection (weddings, parties, concerts), accuracy is high for distinctive events but lower for everyday home photos where context is subtle. The preview step lets you review and correct any folder names before the sort is committed — see the FAQ for more detail on accuracy.

Sort your entire photo library in minutes

PhotoSort uses AI to detect events, name folders intelligently, and build your Year/Month-EventName structure automatically — all inside your browser, with no uploads required.

Try PhotoSort →

One-time purchase · €9.99 · Works on Windows and Mac