Copy and Rename to same directory

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Copy and Rename to same directory Sat Jul 04, 2015 8:01 am • by pickerin
All,

I'm pulling my hair out (and there's not much to start with!).

I'm trying to perform some file modifications (using an AppleScript) on a file, but I don't want to trash the original file. So, I figured I'd just Copy it, then perform my actions on the copy (it's fine for the copy to have a different name).

For the sake of argument, let's say the folder being watched is Desktop. My file is placed there, so Hazel fires:
Copy to folder Desktop (Options: If file exists, rename the file)

However, everytime the rule files, Hazel gives me the error:
"Could not copy the file XXX. Source and Destination are the same."

But that's what I want, I want 2 files, same contents, different names, same folder. Then I want my AppleScript to modify the second file (or the first, doesn't matter).

Can the Move or Copy operations happen within the same folder? Or do you always have to make the destination a different folder?

I was able to accomplish it with two rules, one that copies the file to a different folder, then performs the actions on the original, and a second rule that moves the copy back to the Desktop.

If I was able to just make a copy on the Desktop, then perform actions on the copy, I could do everything in one rule.

Thoughts?
pickerin
 
Posts: 3
Joined: Tue Nov 05, 2013 7:36 am

Re: Copy and Rename to same directory Mon Jul 06, 2015 3:17 pm • by Mr_Noodle
You can't have the source and destination folders be the same for those actions. While it might make sense for the case where you select the option to rename if the file exists, it doesn't for the other option choices. In such a case, the user may not realize that they will end up operating on the original file with any subsequent actions. So, for the time being, you'll have to use a separate folder.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support