Getting two results with Automator Workflow

I am new to Automator & I am working on a Workflow that will simply back up folders to my external HD.

  1. Get specified finder items (folders containing my work files)
  2. Create new folder with name: Today’s date (Month day & year)
  3. Copy Finder items to the new folder.

The workflow runs correctly EXCEPT that it is creating two identical folders. Both folders have today’s date with the second folder appending the number 2 at the end.

Anybody have a solution?

does this happen the first time you run the script or if you run it more than once on the same day? if its the latter of the two then its because everytime you run the script it will create that folder. your best bet would be to replace the create folder with run applescript that has an if exist then otherwise create. when i get a chance if you havent got it yet i will write something up.

Here we go, copy and past this into Automator in a run script action.

tell application "Finder"
	set myday to day of (current date) as string
	set mymonth to month of (current date) as string
	set mydate to mymonth & myday
	set mydir to "Macintosh HD:Users:username:desktop:" --change to location where folder should be
	if exists folder (mydir & mydate) then
		make new folder at "Macintosh HD:Users:username:desktop" with properties {name:(mydate)}
	end if
end tell

Test this on my Mac and made a folder titled December22 on my desktop. If you would like to change the variables a little bit add

set myloc to mydir & "text" & mydate

or something similar and then replace if exists folder (mydir & mydate) then with if exists folder (myloc) then