Can anyone help me with this.
What I want to do is create a workflow where I right click on a folder or some items (usually images) & activate the workflow which would:
Get selected Finder items
Get folder contents
Create a new folder on the desktop
Copy the previously selected items to the newly created folder
And then carry on with more actions.
The problem I’m having is if I get the selected items & then create a new folder the previously selected items are no longer selected so I can’t carry on processing the files.
I guess what I need is something like a an action that would store the items so I could create the new folder & then copy or paste the items into the newly created folder (I’ve tried ‘copy to clipboard’, ‘create new folder’ & then ‘get clipboard contents’ but this didn’t work).
Don’t know much about Automator, but in AppleScript, it goes like this:
tell application "Finder" -- note that no location for the folder is given below; the Finder defaults to the desktop.
set S to selection -- one or more files and/or folders
if exists folder "Duplicates" then -- check if such a folder is already there.
if button returned of (display dialog "A duplicates folder exists. Do you want to use that?") is "OK" then -- Cancel will quit, "OK" will duplicate to the "Duplicates" folder already there, replacing any files that were already in Duplicates if they were selected again.
duplicate S to folder "Duplicates" with replacing -- this includes the contents of any folders in the selection.
end if
else -- make a new folder and duplicate the files to it.
set DF to make new folder with properties {name:"Duplicates"}
duplicate S to folder "Duplicates" with replacing
end if
end tell