只能从MAC使用AppleScript文件夹中删除PDF文件 [英] Delete PDF files only from folder using Applescript on MAC
问题描述
我只需要从网络驱动器上的文件夹中删除PDF文件。还有我无法触摸到文件夹中的其他文件类型。我假设我有选择或先找出PF文件,然后将其移动到垃圾桶或删除。
我到目前为止有:
告诉应用程序发现者
设置theFolder为Macintosh的HD:用户:Kathlene:桌面:ABC123_JOB
设置destFolder为服务器/工作/ TRANSFER_TRASH /
设置thePDFs为theFolder的每一个文件,其扩展名是PDF
移动thePDFs到destFolder
告诉结束
我得到了一个错误:
错误无法获得\\的每一个文件的Macintosh
高清:用户:Kathlene:桌面:ABC123_JOB:\\。从每一个文件编号-1728
中的Macintosh HD:用户:Kathlene:桌面:ABC123_JOB
块引用>解决方案尝试:
告诉应用程序发现者删除(文件夹中的文件的Macintosh HD:用户:Kathlene:桌面:ABC123_JOB,其扩展名是PDF)
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
What I get for an error:
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"
解决方案Try:
tell application "Finder" to delete (files of folder "Macintosh HD:Users:Kathlene:Desktop:ABC123_JOB" whose name extension is "pdf")
这篇关于只能从MAC使用AppleScript文件夹中删除PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!