AppleScript名:指定ボリウム(サーバーボリウム)の空き容量を調べる |
— Created 2015-05-14 by Shane Stanley use AppleScript version "2.4" use scripting additions use framework "Foundation" set serverName to "maro" set aRes to getVolumeFreeSpace(serverName) of me on getVolumeFreeSpace(serverName) set anNSURL to (current application’s |NSURL|’s fileURLWithPath:"/Volumes")’s URLByAppendingPathComponent:serverName set theResult to (anNSURL’s checkResourceIsReachableAndReturnError:(missing value)) as boolean if not theResult then — not mounted, so handle error return false end if set {theResult, theSpare} to anNSURL’s getResourceValue:(reference) forKey:(current application’s NSURLVolumeAvailableCapacityKey) |error|:(missing value) if theResult as boolean then set spareString to (current application’s NSByteCountFormatter’s stringFromByteCount:theSpare countStyle:(current application’s NSByteCountFormatterCountStyleFile)) as text else — couldn’t get the value, so handle error error end if end getVolumeFreeSpace |
More from my site
(Visited 27 times, 1 visits today)