Hi,
I’m new to any kind of programming. I’m trying to move “Test File” of “Test Folder” to a new location with the path
“Macintosh HD:Investing:IBD:Sector Leaders:Sector 11:”
Here is my code
set testFile to “Macintosh HD:Users:macbook:Desktop:TestFolder:TestFile:”
set testFolder to “Macintosh HD:Users:macbook:Desktop:TestFolder:”
move testFile of testFolder to “Macintosh HD:Investing:IBD:Sector Leaders:Sector 11:”
thanks,
Dave
Hi,
first of all, only the Finder can move files or folders.
If the literal string represents a folder, a trailing colon is recommended
If the literal string represents a file, omit the trailing colon.
In the Finder tell block use the specifiers file and folder before string paths.
Your testFile of testFolder cannot work, because even in a Finder tell block and with the specifier keywords the path would be
“Macintosh HD:Users:macbook:Desktop:TestFolder:Macintosh HD:Users:macbook:Desktop:TestFolder:TestFile:”
set testFile to "Macintosh HD:Users:macbook:Desktop:TestFolder:TestFile"
set destinationFolder to "Macintosh HD:Investing:IBD:Sector Leaders:Sector 11:"
tell application "Finder"
move file testFile to folder destinationFolder
end tell