所以我有一个朋友,我试图帮忙。他刚买了一台新的MacBook Pro,目前正在经历将iTunes中的所有音频文件转换为“.mp3”扩展名的过程。 Afterwords,他将这些文件移动到一个外部设备(它出于某种原因不会播放“.m4a”),然后他想删除.mp3s。我在AppleScript方面没有任何经验,但我想知道是否有人有任何编写删除某种类型的所有文件的脚本的经验。任何帮助深表感谢。使用AppleScript删除iTunes中的设置文件
-1
A
回答
0
你应该真的发布代码,即使它是错误的,以显示一些努力。但是,这应该让你开始。节日快乐。
set targetFolder to (choose folder)
tell application "Finder" to delete (files of targetFolder whose name extension = "mp3")
,或者如果你想递归搜索...
set targetFolder to (choose folder)
tell application "Finder" to delete (files of (entire contents of targetFolder) whose name extension = "mp3")
0
这会将所有MP3文件在iTunes资料库的垃圾桶:
tell application "iTunes" to location of tracks where kind is "MPEG audio file"
tell application "Finder" to move result to trash
如果所有的MP3文件都在〜/音乐,你也可以运行这样的命令:
find ~/Music -name \*.mp3 -delete
此脚本将删除曲目,其文件不会从iTunes资料库中发现:
tell application "iTunes"
repeat with t in (get file tracks of library playlist 1)
if location of t is missing value then delete t
end repeat
end tell
相关问题
- 1. 使用AppleScript删除从文件
- 2. 使用AppleScript在OSX上从iTunes库中删除歌曲(URL)
- 3. AppleScript iTunes:按位置选择文件?
- 4. Applescript或shellscript删除配置文件?
- 5. 标签设置到文件使用AppleScript
- 6. 用AppleScript重命名iTunes文件
- 7. 删除文本,Applescript
- 8. 使用AppleScript将路径更改为iTunes中的文件
- 9. 使用Applescript或Linux从文件名中删除字符串
- 10. 使用Applescript将特定文件夹的内容导入到iTunes
- 11. 如何使用AppleScript在iTunes中设置播放列表的曲目?
- 12. 从“设置”文件中删除条目
- 13. Applescript iTunes Reveal
- 14. Applescript,iTunes和'date'
- 15. 使用Fastlane从配置文件中删除设备
- 16. 设置文本的AppleScript
- 17. 删除“copy#” - 使用applescript在photoshop中的图层文字
- 18. 设置文件的元数据使用AppleScript和Automator的
- 19. 使用Powershell从Windows注册表值设置的文件夹中删除文件
- 20. 如何使用AppleScript在iTunes中的子文件夹中选择播放列表?
- 21. 使用AppleScript在Numbers中设置边框?
- 22. 如何设置要用Applescript编辑的文件中的索引?
- 23. 什么是移动/删除文件的AppleScript文件夹操作?
- 24. 如何使用Applescript搜索iTunes?
- 25. 如何修复我的AppleScript以删除iTunes中的曲目选择?
- 26. 使用AppleScript将邮件信息设置为纯文本
- 27. 设置onclick事件删除
- 28. AppleScript的控制iTunes和RDIO
- 29. 没有applescript脚本的iTunes?
- 30. 如何删除邮件的邮箱使用AppleScript
你阅读本:http://stackoverflow.com/questions/15281869/delete-pdf-files-only-from-folder -using-applescript-on-mac – Kara
那么大概它可能是这样简单的: 告诉应用程序“iTunes”要删除(文件夹“路径在这里”的文件扩展名是“mp3”)? 那么,我唯一的问题就是如何执行脚本? AppleScript是否从终端执行? –
你应该试试AppleScript Editor。它在'/ Applications/Utilities'中。 –