[Mac] 移除與重新啟用目錄的 Folder Action

[Mac] 移除與重新啟用目錄的 Folder Action

昨天寫了一篇 用 Automator 的 Folder Action,自動將痞客邦備份檔移到 Dropbox

不過馬上就遇到了一個問題:如果不想要這個 Folder Action 了,要怎麼移除呢?

在網路爬文,大多是找到第一個解法,

不過自己正好又試出另一個方法,兩個都來說明一下吧~

 

1. 使用 Remove Folder Actions.scpt

開啟 terminal 後,先進到要移除 Folder Action 的目錄,

接著執行 /Library/Scripts/Folder Actions/Remove Folder Actions.scpt~

像我想移除 ~/Downloads 目錄的 Folder Action,就執行下面的指令:

cd ~/Downloads
osascript "/Library/Scripts/Folder Actions/Remove Folder Actions.scpt"

 

假設這個目錄下有 Folder Action 的話,會跳出如下的對話框,先選擇目前的目錄:

Screen Shot 2016-10-07 at 2.08.22 PM

 

再選擇要移除的 Folder Action,按下 OK 就會移除了:

Screen Shot 2016-10-07 at 2.08.30 PM

 

若是目錄下沒有 Folder Action 的話,就會看到這個畫面:

Screen Shot 2016-10-07 at 2.08.39 PM  

 

2. 使用 Finder 提供的 Folder Action Setup Service

這是我自己湊巧發現的,在 Finder 裡面,

對著要移除 Folder Action 的目錄按右鍵 > Services > Folder Actions Setup:

Screen Shot 2016-10-07 at 4.36.00 PM

 

在這邊就可以很方便的管理 Folder Action,

按右下角的 +/- 鈕,就可以新增/移除目錄的 Folder Action:

Screen Shot 2016-10-07 at 4.36.35 PM  

 

個人覺得第二個方法比較方便,

不用特別去記得要用 /Library/Scripts/Folder Actions/Remove Folder Actions.scpt,

而且這個方法還解決了我另一個問題,這邊來說明一下吧~

我原本用了第一個方法移除了 Folder Action,後來想再加回去,

正好我之前有把 Automator 中的 Folder Action 匯出成 .workflow,

於是我執行了 open xxx.workflow 後,可以按下 Install 安裝這個 Folder Action:

Screen Shot 2016-10-07 at 3.07.41 PM

 

從訊息來看,這個 Folder Action 已經連結到 ~/Downloads 目錄了:

Screen Shot 2016-10-07 at 3.08.05 PM  

 

不過怪異的是,這個重新安裝上的 Folder Action 似乎並沒有生效,

我的痞客邦備份檔並沒有被自動移到 Dropbox 目錄下…

用了第二個方法檢視了一下,發現那個 workflow 是存在的,但並沒有真的與 ~/Downloads 目錄連結,

因此只要按下右下角的 + 鈕,選擇已經存在的 workflow,這個 Folder Action 就正常了~

 

參考資料:How do I remove folder action for folder that doesn’t exist?

 

(本頁面已被瀏覽過 329 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料