Created
September 4, 2020 21:51
-
-
Save ozrabal/1561cdb95f74c28d6a07159c3416f5cb to your computer and use it in GitHub Desktop.
Create new folder from selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Finder" | |
set selectedFiles to selection as alias list | |
set containingFolder to container of item 1 of selectedFiles | |
set {year:yr, month:mn, day:dy} to creation date of item 1 of selectedFiles | |
set convertedDate to (yr & "-" & (text -2 thru -1 of ("00" & ((mn) as integer))) & "-" & (text -2 thru -1 of ("00" & ((dy) as integer)))) as string | |
set theFolder to (make new folder at containingFolder with properties {name:convertedDate}) | |
repeat with i from 1 to count of selectedFiles | |
set thisItem to item i of selectedFiles | |
move thisItem to (theFolder) | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment