在 MAC 上使用 Applescript 仅从文件夹中删除 PDF 文件

编程入门 行业动态 更新时间:2024-10-08 06:20:04
本文介绍了在 MAC 上使用 Applescript 仅从文件夹中删除 PDF 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我只需要从网络驱动器上的文件夹中删除 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 14:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/915777.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   夹中   MAC   Applescript   PDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!