> ## Documentation Index
> Fetch the complete documentation index at: https://photocli.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Group All Photos Into Year, Month, and Day Folders

> Use photo-cli copy to flatten all photos into a year/month/day folder hierarchy and rename each file with its full date and time, ordered chronologically.

This example flattens all photos — regardless of which subfolder they originally lived in — into a `[year]/[month]/[day]` folder hierarchy, and renames every file with its full taken date and time. The result is a single chronological archive that ignores the original folder names completely.

## Command

<CodeGroup>
  ```bash Long form theme={null}
  photo-cli copy \
    --process-type FlattenAllSubFolders \
    --group-by YearMonthDay \
    --naming-style DateTimeWithSeconds \
    --number-style OnlySequentialNumbers \
    --input photos \
    --output organized-albums
  ```

  ```bash Short form theme={null}
  photo-cli copy -f 3 -g 1 -s 4 -n 3 -i photos -o organized-albums
  ```
</CodeGroup>

## Key arguments

| Argument         | Value                   | What it does                                                                                        |
| ---------------- | ----------------------- | --------------------------------------------------------------------------------------------------- |
| `--process-type` | `FlattenAllSubFolders`  | Ignores the original folder hierarchy and treats every photo as if it were in one pool.             |
| `--group-by`     | `YearMonthDay`          | Creates output folders named by year, then month, then day, derived from the EXIF taken date.       |
| `--naming-style` | `DateTimeWithSeconds`   | Names each output file as `yyyy.MM.dd_HH.mm.ss.ext`, including hours, minutes, and seconds.         |
| `--number-style` | `OnlySequentialNumbers` | When two photos share the exact same taken timestamp, appends `-1`, `-2`, etc. to distinguish them. |

## Before and after

**Before** (`photos/`):

```text theme={null}
├── DSC_5727.jpg
├── GOPR6742.jpg
├── Italy album
│   ├── DJI_01732.jpg
│   ├── DJI_01733.jpg
│   ├── DSC00001.JPG
│   ├── DSC03467.jpg
│   ├── DSC_1769.JPG
│   ├── DSC_1770.JPG
│   ├── DSC_1770_(same).jpg
│   ├── DSC_1771.JPG
│   ├── GOPR7496.jpg
│   ├── GOPR7497.jpg
│   ├── IMG_0747.JPG
│   └── IMG_2371.jpg
└── Spain Journey
    ├── DSC_1807.jpg
    ├── DSC_1808.jpg
    └── IMG_5397.jpg

2 directories, 17 files
```

**After** (`organized-albums/`):

```text theme={null}
├── 2005
│   ├── 08
│   │   └── 13
│   │       └── 2005.08.13_09.47.23.jpg
│   └── 12
│       └── 14
│           └── 2005.12.14_14.39.47.jpg
├── 2008
│   ├── 07
│   │   └── 16
│   │       └── 2008.07.16_11.33.20.jpg
│   └── 10
│       └── 22
│           ├── 2008.10.22_16.28.39.jpg
│           ├── 2008.10.22_16.29.49.jpg
│           ├── 2008.10.22_16.38.20.jpg
│           ├── 2008.10.22_16.43.21.jpg
│           ├── 2008.10.22_16.44.01.jpg
│           ├── 2008.10.22_16.46.53.jpg
│           ├── 2008.10.22_16.52.15.jpg
│           ├── 2008.10.22_16.55.37.jpg
│           ├── 2008.10.22_17.00.07-1.jpg
│           └── 2008.10.22_17.00.07-2.jpg
├── 2012
│   └── 06
│       └── 22
│           └── 2012.06.22_19.52.31.jpg
├── 2015
│   └── 04
│       └── 10
│           ├── 2015.04.10_20.12.23-1.jpg
│           └── 2015.04.10_20.12.23-2.jpg
├── IMG_5397.jpg
└── photo-cli-report.csv

16 directories, 18 files
```

## What you see in the output

All 17 source photos are reorganized by date, completely ignoring which album they came from. The Italy album photos taken on 22 October 2008 are grouped together under `2008/10/22/`, and the Spain Journey photos from 10 April 2015 land in `2015/04/10/`.

Two photos share the exact same timestamp (`2008.10.22_17.00.07`), so photo-cli appends `-1` and `-2` to keep them distinct. The same applies to the two Madrid photos at `2015.04.10_20.12.23`.

`Spain Journey/IMG_5397.jpg` has no EXIF taken date, so it is placed at the root of the output as `IMG_5397.jpg` (the original file name is kept as a fallback).

<Tip>
  This approach is useful when you want to build a single chronological archive from photos scattered across many differently named albums, and you do not need location data in the file names. It pairs well with the `archive` command when you want to run it incrementally over time.
</Tip>
