When a folder tree is copied, restored from a backup or unpacked from an archive, every folder tends to end up with the date of the copy while the files inside keep their own dates. A photo archive sorted by date then shows one date for everything. The Set the folder's creation/ modification date from the files inside action puts the folder dates back by reading them from the files.

It is the counterpart of Copy the enclosing folder's creation/ modification date to its files, described under copying dates between fields and from folders, which works in the other direction and gives files the dates of their folder.

The controls

  • Set folder creation date and Set folder modification date choose which of the two folder dates are written. Tick one or both.
  • Each has its own source menu: from the earliest creation date of its files, from the latest creation date of its files, from the earliest modification date of its files or from the latest modification date of its files. The defaults, the creation date from the earliest creation date and the modification date from the latest modification date, make each folder span the files it contains, so that a parent folder sorted by either date lists its folders in the order the work happened.
  • Look at: decides which files count: files directly inside the folder or files in all subfolders too. With the second choice a year folder that holds only month folders is dated from the photos inside the month folders.

The action works on folders, so it switches Folders on under Process: when it is selected and says so under its parameters. Files in the file list pass through unchanged; the action only writes to folders.

The preview

The Created and Modified columns of the file list show each folder’s current date on top and the date it will get underneath. Hover over the new date to see which file it comes from, for example from 2016/July/IMG_0412.jpg. A folder that contains no files that count shows no files, unchanged and is left alone. Nothing is written until you click Perform Changes.

The rules

  • Only files count. Subfolders are never used as sources themselves, at any depth; with files in all subfolders too the files inside them are. The order in which nested folders are processed therefore does not matter: a parent never reads a date that the action has just written to one of its subfolders.
  • Packages count as files. An .app bundle, a Photos library or a Pages document counts as one file, as it does in the file list, and is never looked into.
  • Invisible files are ignored, without a checkbox: .DS_Store, files whose names start with a dot, the ._ AppleDouble files found on USB sticks and network volumes, and files with the Finder’s hidden flag. Hidden subfolders such as .git are skipped too, so they never feed dates into their parent.
  • Symbolic links and Finder aliases are ignored and never followed.
  • A folder without files is left alone. Both dates stay as they are; no error is reported.
  • Dates before 1972 are skipped as sources while the pre-1972 date check is on; see inconsistent file dates for what macOS itself allows.
  • Inconsistent dates are corrected automatically, because macOS does not allow a folder to be modified before it was created. When only the creation date is set and it would land after the folder’s current modification date, the modification date moves up with it; when only the modification date is set and it would land before the current creation date, the creation date moves down with it.
  • Folders that cannot be read are reported, not guessed at. A folder whose contents cannot be listed is left unchanged and shows an error. A subfolder that cannot be read is skipped, the folder is dated from the files that could be read, the tooltip on the new date names the subfolder, and the summary at the end says how many folders were affected.

Photo archives

For an archive of photos whose folders have lost their dates, run Copy EXIF content creation timestamp to file creation date first, so that each photo’s file creation date is its shooting date, then this action with the creation date from the earliest creation date of its files and the modification date from the latest modification date of its files. Each folder then spans the shots inside it and the Finder sorts the folders in the order the pictures were taken; see fixing photo sorting in the Finder for the first step.

Try it on your own files

The free trial processes up to 5 files at a time, with no time limit. Version 7.55 for macOS 15 Sequoia and later, Intel and Apple Silicon. Older macOS versions