0
votes

I've checked the previous answers to similar questions in Stackoverflow and there seems to be a problem even with the most basic sentence that uses the move function. In my case, I'm using the following script.

set theFile to "Macintosh HD/Users/sergioguerra1/Downloads/Reporte General.csv"
set theFolder to "Macintosh HD/Users/sergioguerra1/Desktop/Detektor/Etapa II/"

tell application "Finder"
    move file theFile to folder theFolder with replacing
end tell 

And I got the following error:

"error "Finder got an error: Can’t get file \"Macintosh HD/Users/sergioguerra1/Downloads/Reporte General.csv\"." number -1728 from file "Macintosh HD/Users/sergioguerra1/Downloads/Reporte General.csv""

I changed the script a little bit

tell application "Finder"
    move theFile to theFolder with replacing
end tell 

And I got a different error

"error "Finder got an error: AppleEvent handler failed." number -10000"

This is a very simple code, but isn't working. Can anyone find the error? Is it something with Mavericks?

1

1 Answers

3
votes

In AppleScript you have different kind of path notations and you are mixing these two. HFS paths are used by the file and alias class. The path starts with a volume name and is separated by a ':'. Posix path file notations is used by the posix file class. It always starts with the root folder of the file system (other systems are mounted into this file system) and uses a '/' as it's separator. Since your command starts with move file you're already indicating that the file path notation must be a HFS path:

set theFile to "Macintosh HD:Users:sergioguerra1:Downloads:Reporte General.csv"
set theFolder to "Macintosh HD:Users:sergioguerra1:Desktop:Detektor:Etapa II"

tell application "Finder"
    move file theFile to folder theFolder with replacing
end tell