使用applescript在finder中移动文件 [英] move a file in finder with applescript

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

问题描述

我只想将图像从一个文件夹移动到另一个文件夹,替换已经存在的图像:

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

Finder 出错:无法将文件夹 [path] 设置为文件 [path]"."number-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在finder中移动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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