[Skitch]キャッシュをゴミ箱に入れる
#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property refMe : a reference to current application
##パス
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
set ocidPrefDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Containers/com.skitch.skitch/Data/tmp")
##コンテンツ収集 1階層のみ
set ocidOption to (refMe's NSDirectoryEnumerationSkipsHiddenFiles)
set ocidKeyArray to refMe's NSArray's arrayWithArray:({(refMe's NSURLPathKey), (refMe's NSURLIsDirectoryKey), (refMe's NSURLIsSymbolicLinkKey)})
set listSubPathResult to (appFileManager's contentsOfDirectoryAtURL:(ocidPrefDirPathURL) includingPropertiesForKeys:(ocidKeyArray) options:(ocidOption) |error|:(reference))
set ocidSubPathURLArray to item 1 of listSubPathResult
###収集したURLの数だけ繰り返し
repeat with itemSubPathURL in ocidSubPathURLArray
###ゴミ箱に入れる
set listDone to (appFileManager's trashItemAtURL:(itemSubPathURL) resultingItemURL:(itemSubPathURL) |error|:(reference))
end repeat
| 固定リンク
「NSFileManager」カテゴリの記事
- [com.apple.shortcuts.mac-helper] macOS15.3.1での変更点(NSFileManager temporaryDirectoryの戻り値が変わる場合がある)(2025.02.14)
- ファイルのある親フォルダ名をファイル名にする(2024.09.13)
- [contentsOfDirectoryAtURL]コンテンツURLの収集 第一階層のみ(2024.09.02)
- [Skitch]キャッシュをゴミ箱に入れる(2023.11.11)
- [NSFileManager]ファイルのコピー (Acrobatのスタンプデータのバックアップを作成する)(2023.10.20)