在取景器的AppleScript移动文件 [英] move a file in finder with applescript

查看:143
本文介绍了在取景器的AppleScript移动文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想将图像从一个文件夹移动到其他,替换一个是已经在那里:

I just want to move an image from one folder to the other, replacing the one that's already in there:

tell application "Finder"
      copy file "/Users/xx/Documents/img.jpg" to folder "/Users/xx/Documents/State"
   end tell

当我运行它,我得到一个错误信息说

When I run it, I get an error message saying

查找得到了一个错误:无法设置文件夹[路径]文件[路径]号
  从-10006文件夹[路径]

Finder got an error: Can’t set folder [path] to file [path]"."number -10006 from folder [path]

请帮帮我!

推荐答案

尝试:

tell application "Finder"
    duplicate POSIX file "/Users/xx/Documents/img.jpg" to POSIX file "/Users/xx/Documents/State" with replacing
end tell

或者

tell application "Finder"
    move POSIX file "/Users/xx/Documents/img.jpg" to POSIX file "/Users/xx/Documents/State" with replacing
end tell

这篇关于在取景器的AppleScript移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆