The image 「http://www.macupdate.com/images/icons/19044.png」 cannot be displayed, because it contains errors. Clean Up Non Mac Disks 1.1.1

DESCRIPTION

Mac OS X litters many hidden files on non-native partitions and shared network drives. Clean Up Non Mac Disks is an AppleScript application for getting rid of them. Just drop the partition onto Clean Up Non Mac Disks or select the partition to clean after double clicked before ejecting.

WHAT'S NEW

Version 1.1.1:
  • Fixed a bug for announcement does not work on non-English interface.
REQUIREMENTS
  •         Mac OS X 10.2 or later.
按此下載

請下載後,雙響滑鼠來爆開成為「Clean Up Non Mac Disks」,閣下可以將它放到硬碟任何地方,本人提議放到 [Macintosh HD]:Applications: 之中。

共有兩個使用辦法,一個是簡單的雙響滑鼠「Clean Up Non Mac Disks」它便會找出所有可以退出,又可以寫,同時又不是用 Apple File System (HFS+、HFS、AFS)的硬碟,包括網絡上 mount 回來的硬碟。然後列個清單,讓閣下選擇。可以選擇多於一個硬碟。按下 OK 鍵就會替閣下清理了。完成後會用聲音告訴大家的。

另一個用法,便是把一個或多個硬碟拖到「Clean Up Non Mac Disks」上,它便會自動清理。完成後,同樣會告訴你的。

之後便可以退出那個沒有 Mac 專用 meta files 的硬碟了。


Mac OS X 在掛載某些檔案系統時;為了記錄檔案資訊,會產生很多 .* 檔案。

例:

/Volumes/ABEILLE/.DS_Store
/Volumes/ABEILLE/._.DS_Store
/Volumes/ABEILLE/港自殺率高於全球平均.html
/Volumes/ABEILLE/._港自殺率高於全球平均.html
/Volumes/ABEILLE/自殺.html
/Volumes/ABEILLE/._自殺.html
/Volumes/ABEILLE/青少年對「自殺行為」的態度與看法.html
/Volumes/ABEILLE/._青少年對「自殺行為」的態度與看法.html


其中 ABEILLE 為 USB 隨身碟的名稱。若此隨身碟拿到 PC 上 ,會看到很多 .* 檔案,令人煩惱。

刪除這些 .* 檔案的 shell command 為:

代碼:

$ find pathToVolume -name '.*' -exec rm -f {} \;


其中 pathToVolume 為檔案系統的絕對路徑;若掛載點為 /Volumes,循上例:

代碼:

$ find /Volumes/ABEILLE -name '.*' -exec rm -f {} \;


若不欲每次輸入指令,卸載檔案系統前可執行這
applescript;它會自行偵測 可退出、使用 USB 的卷宗,並刪除所有.* 檔案。

代碼:

tell application "System Events" to set targetDisk to name of disks whose ejectable is true and not (format is audio format)

repeat with i in targetDisk
set chosenDisk to quoted form of POSIX path of (contents of i)
set cmd to ("diskutil info " as Unicode text) & chosenDisk & " | grep Protocol"
if word -1 of (do shell script cmd) = "USB" then
try -- delete .* files
set dcmd to ("find " as Unicode text) & chosenDisk & " -name '.*' -exec rm -f {} \\;"
do shell script dcmd
end try
end if
end repeat
say "done"


代碼:
on run
-- get a list of Non-native Apple formatted partitions, and excluding Network
tell application "System Events" to set potentialVolumes to name of disks whose (format is not Mac OS Extended format) and (format is not Mac OS format) and name is not "Network"
-- (format is not 《constant ****as》)
if length of potentialVolumes = 0 then
display dialog "No disk requires cleaning!" buttons {"OK"} default button 1
else
-- ask user to choose volumes
set chosenVolumes to (choose from list potentialVolumes with prompt "Please choose the Volume to be cleaned" with multiple selections allowed without empty selection allowed)
if chosenVolumes is not false then
repeat with i in chosenVolumes
tell application "System Events" to set f to (format of disks whose name is i)
cleanUp(i)
end repeat
say "Disks cleaned"
end if
end if
end run

on cleanUp(targetVolume)
set mountedPath to quoted form of POSIX path of (contents of targetVolume)
try -- delete ._* files
set dcmd to ("find " as Unicode text) & mountedPath & " -name '._*' -exec rm -f {} \\;"
do shell script dcmd
end try
try -- delete .DS_Store folders
set dcmd to ("find " as Unicode text) & mountedPath & " -name '.DS_Store' -exec rm -R -f {} \\;"
do shell script dcmd
end try
try -- delete .Trashes folder
set dcmd to ("find " as Unicode text) & mountedPath & " -name '.Trashes' -exec rm -R -f {} \\;"
do shell script dcmd
end try
end cleanUp
 
_________________

全站熱搜

Bluelove1968 發表在 痞客邦 留言(0) 人氣()