How to Add a Date to Filenames on Mac
Adding dates to filenames creates a permanent chronological record that survives metadata stripping, file transfers, and format conversions. macOS provides several approaches for date insertion, from simple Terminal commands to dedicated tools with format customization and multiple date sources.
Should You Add Dates as a Prefix or Suffix?
Prefix dates transform filenames like report.pdf into 2026-03-26_report.pdf. Every file in the directory sorts by date first, creating a timeline view in Finder. This approach works well for daily logs, meeting notes, and photo collections where the date is the primary organizing dimension. Prefix dates also make it easy to find all files from a specific day by scrolling to that date range.
Suffix dates transform the same file into report_2026-03-26.pdf. Files sort by their descriptive name first, grouping related files together regardless of date. This works well for project deliverables where the document name carries more meaning than the creation date. You can still search by date using Finder's search function. Choose the position that matches your primary browsing pattern.
What Date Formats Can You Use in Filenames?
The ISO 8601 format (YYYY-MM-DD) is the universal standard for dates in filenames. Placing the year first ensures correct alphabetical sorting across years, months, and days. The hyphen separator improves readability without interfering with file systems. The compact variant YYYYMMDD omits separators for shorter filenames while preserving sort order. Both formats are widely recognized across operating systems and applications.
European (DD.MM.YYYY) and US (MM-DD-YYYY) formats are familiar to their respective audiences but break alphabetical sorting. Files from December sort before files from January because the day or month appears first. These formats work when files are organized in folders by month or year and chronological sorting within the folder is not required. For comprehensive format token reference, see the custom date format guide.
What Date Sources Are Available for Filename Dates?
Created date is the most stable source because it never changes after the file is first saved. Photographers use created dates to maintain shooting order. Document managers use created dates to record when a file originated. The created date survives file edits, metadata updates, and most copy operations on macOS. The creation date rename guide covers this source in detail.
Modified date tracks the most recent change to file contents. This source is useful for version tracking workflows where the latest edit date matters more than the original creation date. Current date stamps every file with today's date regardless of when the file was created or last modified. This is useful for batch processing workflows where the processing date serves as the organizational marker. Batchio's Date Insertion rule provides all three sources in a dropdown menu.
How Do You Add Dates to Filenames with Terminal?
for loop that extracts the file date with stat and prepends or appends it with mv. The command for f in *.pdf; do d=$(stat -f %SB -t %Y-%m-%d "$f"); mv "$f" "${d}_$f"; done prefixes each PDF with its creation date.Terminal provides complete flexibility for date insertion through shell scripting. Thestat command reads the creation date, the date command formats the current date, and the GetFileInfo command retrieves creation or modification dates. You construct the new filename by concatenating the date string with the original filename and execute the rename with mv.
Terminal scripts require careful quoting to handle filenames with spaces and special characters. The script must also handle edge cases like files that already contain dates in their names. There is no built in preview or undo, so mistakes affect all files immediately. For a visual approach with preview and undo, use Batchio's Date Insertion rule. See the batch rename guide for the complete Terminal reference.
How Does Batchio Add Dates to Filenames?
Batchio's Date Insertion rule reads the selected date from each file's metadata individually. Unlike Terminal scripts that require manual date extraction, Batchiohandles the metadata reading automatically. Select Created, Modified, or Current from the source dropdown, type a format string like yyyy-MM-dd, and the live preview updates instantly with every file's resulting name.
The rule supports prefix and suffix positions with a customizable separator character. Stack it with other rules to build complex naming patterns. For example, combine Date Insertion with a Numbering rule to create filenames like 2026-03-26_001_photo.jpg. The rule chain executes top to bottom, giving you full control over the final filename structure. For advanced format tokens, see the prefix guide for adding date prefixes to filenames.
Frequently Asked Questions
Can Finder add a date to filenames automatically?
What date format should you use in filenames?
Can you add both date and time to filenames on Mac?
Does adding a date to a filename change the file's actual date metadata?
Add Dates to Filenames in Seconds
Download Batchio free on the Mac App Store. All 9 rule types included. Pro upgrade $4.99.
Coming Soon to the Mac App StoreMarcel Iseli is an indie app developer and the creator of Batchio. He builds native macOS utilities focused on productivity and file management, with a focus on lightweight, subscription-free tools.