在 MAC 上使用 Applescript 仅从文件夹中删除 PDF 文件 [英] Delete PDF files only from folder using Applescript on MAC

查看:23
本文介绍了在 MAC 上使用 Applescript 仅从文件夹中删除 PDF 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要从网络驱动器上的文件夹中删除 PDF 文件.文件夹中还有其他文件类型我无法触及.我假设我必须首先选择或识别 PF 文件,然后将它们移到垃圾箱或删除它们.

I need to delete the PDF files only from a folder on a network drive. There are other file types in the folder I can not touch. I am assuming I have to choose or identify the PF files first and then move them to the trash or delete them.

到目前为止我所拥有的:

What I have so far:

tell application "Finder"
    set theFolder to "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB"
    set destFolder to "Server/JOBS/TRANSFER_TRASH/"
    set thePDFs to every file of theFolder whose name extension is "pdf"
    move thePDFs to destFolder
end tell

我得到的错误信息:

错误无法获取\"Macintosh 的每个文件HD:Users:Kathlene:Desktop:ABC123_JOB:\"."每个文件中的编号 -1728Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB"

error "Can’t get every file of \"Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB:\"." number -1728 from every file of "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB"

推荐答案

尝试:

tell application "Finder" to delete (files of folder "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB" whose name extension is "pdf")

这篇关于在 MAC 上使用 Applescript 仅从文件夹中删除 PDF 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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