Create Folders Based on the Creation Dates of the Selected Files then Move the Files into the Relevant Folders

I'm trying to create a macro that will take a set of files, grab their creation date, create folders with names based on those creation dates (e.g., 2014-01-03), then move the files into these folders. I thought this might work, but no luck: the folder name isn't being generated from the "Set Named Clipboard" step:

For Each Item in the Collection Execute Actions
The recursive contents of folder ‘/Users/derekvan/Documents/Action’
Execute the Following Actions:
Get Date Created to Variable ‘Date’
From file: %Variable%File% Notify on failure.
Set Named Clipboard ‘NAS’ to Styled Text
%ICUDateTimeFor%%Variable%Date%%yyyy-MM-dd%
Create New Folder ‘/Volumes/photo/%NamedClipboard%NAS%’
Notify on failure.
Move or Rename File ‘%Variable%File%’
To: /Volumes/photo/%Variable%Date%
Notify on failure.
````````

Below is an example for renaming files to their creation date, which may help.

Don't use a Named Clipboard for this, use a variable.

ICUDateTimeFor's first parameter is a calculation, so you cannot use text tokens like %Variable%Date% you just use Date.

You are creating one folder, and then moving the file somewhere else.

So:

  • Set Variable NewFileName to %ICUDateTimeFor%Date%yyyy-MM-dd%
  • Create Folder /Volumes/photo/%Variable%NewFileName%
  • Move File %Variable%File% to /Volumes/photo/%Variable%NewFileName%

1 Like

That did it! Thanks.

A post was split to a new topic: Create a Series of Date-Stamped Folders with Descriptive Text