0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AppleScriptでiTunesのトラックをファイルごと削除する

Posted at
tell application "iTunes"
  repeat with theTrack in selection
    set dbid to theTrack's database ID
    set filePath to theTrack's location as Unicode text

    --ライブラリから削除
    delete (some track of library playlist 1 whose database ID is dbid)

    --ファイルをゴミ箱へ移動
    tell application "Finder"
      delete file filePath
    end tell
  end repeat
end tell

ライブラリは音楽/動画関係なくlibrary playlistなので、そこからdatabase IDを条件にトラックを削除する。ライブラリから削除しただけではファイルが削除されないので、別途削除する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?