Automator/Applescript 文件排序和移动
我想知道 Automator 中是否有一种方法可以使用 Applescript 代码来获取文件的扩展名,以及它是否等于特定的扩展名(例如 .pdf
或 .rtf
) 移动到该扩展名的特定文件夹(例如 if (extension == pdf) { 移动到文件夹“~/PDF Files” } else if (extension == rtf) { 移动到文件夹“~/Rich Text Files” “ }
)
I was wondering if there was a way in Automator to use Applescript code to get the extension of a file, and if it equals a specific extension (e.g. .pdf
or .rtf
) move to a specific folder for that extension (e.g if (extension == pdf) { move to folder "~/PDF Files" } else if (extension == rtf) { move to folder "~/Rich Text Files" }
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个苹果脚本。因为你的要求很简单,所以我就写给你了。请注意我如何使用子例程“getNameAndExtension(F)”获取文件扩展名。通常,您可以从 Finder 获取文件扩展名(称为名称扩展),但我发现 Finder 并不总是可靠,因此我总是使用该子例程。该子程序一直是可靠的。
Here's an applescript. Since your request was simple I just wrote it for you. Note how I get the file extension with the subroutine "getNameAndExtension(F)". Normally you can get the file extension from the Finder (called name extension) but I've found that the Finder is not always reliable so I always use that subroutine. That subroutine has always been reliable.
我现在不在苹果公司,所以我无法使用 Automator 来解决这个问题。但是,如果您可以通过将查找器切换到列表视图,按类型排序,然后选择相同类型的文件块并将它们拖到正确的文件夹中来做到这一点。
I'm not at my Apple right now, so I can't play around with Automator and figure it out. But if you could do this by switching finder to list view, sort by type, and then select blocks of files of the same type and drag them into the right folder.