Re: [求救] MacOS版的iCloud drive如何不預載檔案

看板MAC作者 (bluewild)時間5年前 (2018/12/26 10:17), 5年前編輯推噓7(815)
留言14則, 11人參與, 5年前最新討論串2/2 (看更多)
※ 引述《bluewild (bluewild)》之銘言: : 像我買了2T的空間 : 但是把照片都放上去大概就佔了600G : 我的Mac硬碟大概佔了一半 : 工作檔案大概又佔一半 : 總之,硬碟空間快不夠了 : 但其實雲上還有超多空間 : 我的想法是 : 在Mac上將沒用到的檔案設定成不預載 : 就是放出硬碟空間了 : 要用再下載即可 : 問題來了 : MacOS 版的iCloud drive 沒有這個功能 : 我查過很多網路上的資訊 : 都是叫我刪垃圾桶或瀏覽器暫存 : 或是不要同步桌面或照片之類的 : 但我的問題不是那些 : 我是想要可以設定檔案不預載 : 那麼各位大大有沒有這方面的經驗呢? : 求解~感謝 找到好方法與各位分享 https://www.macobserver.com/tips/how-to/manual-icloud-sync/ 自己的文章自己回~~ 前情提要 在MacOS中的iCloud Drive 只能對檔案決定是否「下載」 卻不能任意「卸載」 要卸載要看系統心情,容量大,就裝得多 但是有時候硬碟容量就不夠 它就只留區區的幾G,實在很傷腦筋 有人在網路上開發了這個工具 「iCloud Control」 可以「卸載」檔案、或資料夾 也可以針對檔案下載 也可以針對「檔案」直接進行分享 會直接產生一個iCloud Drive 的分享路徑 任何人只要有路徑,都可以下載副本 不管是哪個功能 都超級方便 https://i.imgur.com/xWtJZOp.jpg
文章裡頭提到Git hub 的路徑是 https://github.com/Obbut/iCloud-Control/releases 裡面有全部的原始檔 如果熟悉Git 並且會使用Xcode的話 可以下載後,自行檢查程式碼 若沒問題再行安裝 如果不熟悉Xcode以及封裝流程 可以直接下載路徑上的App安裝 安裝完後,在系統設定上,打勾「延伸功能」即可使用 https://i.imgur.com/nfDXzjY.jpg
敝人試用心得 釋放了百G的空間 超爽的 從今以後 我的硬碟將完整使用2T的iCloud Drive雲端空間 想下載什麼就下載什麼 想卸載什麼就卸載什麼 而不再像以前那樣塞爆我的硬碟 與各位分享~~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.59.168.61 ※ 文章網址: https://www.ptt.cc/bbs/MAC/M.1545790667.A.EBC.html

12/26 10:32, 5年前 , 1F
推推!
12/26 10:32, 1F

12/26 11:09, 5年前 , 2F
12/26 11:09, 2F

12/26 12:11, 5年前 , 3F
不知道穩定性高不高 最怕檔案莫名不見就慘了
12/26 12:11, 3F
大大您的顧慮是對的 所以我在安裝的之前有特別去看了一下原始碼 它的程式碼很簡短 我貼在文下您可以看看 一般來說我們都會擔心程式進行增刪的動作 萬一沒寫好,就會出包 但這程式我看到他是用File Manager的套件 這是蘋果自家的套件 是用這個套件內的指令 相對來說應該是安全得多 也就是說 程式是用回圈去告知蘋果系統,請將這檔案卸載 而不是程式自己去砍 當然 這樣的寫法雖然頗為合理 卻不是代表我幫作者背書唷 大家有興趣可以看看程式碼 就能了解 敝人只是自己是這方面苦主,找到良方之後希望共享之 其中是否安全或穩定 只能說目前我用起來還OK 大家自行判斷,感謝^^ 以下是整個程式 非常簡短 // // FinderSync.swift // iCloudExtension // // Created by Robbert Brandsma on 30-06-16. // Copyright ꤠ2016 Robbert Brandsma. All rights reserved. // import Cocoa import FinderSync class FinderSync: FIFinderSync { let fm = FileManager.default // MARK: - Menu and toolbar item support override var toolbarItemName: String { return "iCloud Control" } override var toolbarItemToolTip: String { return "Manually manage iCloud storage" } override var toolbarItemImage: NSImage { return NSImage(named: "CloudToolbarIcon")! } override func menu(for menuKind: FIMenuKind) -> NSMenu { NSLog("menu(for:)") let menu = NSMenu(title: "") menu.addItem(withTitle: "Remove selected item locally", action: #selec tor(removeLocal(_:)), keyEquivalent: "") menu.addItem(withTitle: "Download selected item", action: #selector(do wnloadItem(_:)), keyEquivalent: "") menu.addItem(withTitle: "Publish public link", action: #selector(publi sh(_:)), keyEquivalent: "") return menu } @IBAction func removeLocal(_ sender: AnyObject?) { NSLog("removeLocal") for target in currentTargets { NSLog("Local removal of \(target) requested") do { try fm.evictUbiquitousItem(at: target) NSLog("Removal of \(target) succeeded") } catch { NSLog("Removal of \(target) failed with error \(error)") } } } @IBAction func publish(_ sender: AnyObject?) { var urls = [URL]() for target in currentTargets { NSLog("Publishing \(target) requested") do { let url = try fm.url(forPublishingUbiquitousItemAt: target, ex piration: nil) NSLog("Publishing \(target) succeeded, url: \(url)") urls.append(url) } catch { NSLog("Publishing \(target) failed with error \(error)") } } let pb = NSPasteboard.general() pb.clearContents() pb.writeObjects(urls as [NSPasteboardWriting]) } @IBAction func downloadItem(_ sender: AnyObject?) { NSLog("Download requested") for target in currentTargets { NSLog("Download of \(target) requested") do { try fm.startDownloadingUbiquitousItem(at: target) NSLog("Download of \(target) succeeded") } catch { NSLog("Download of \(target) failed with error \(error)") } } } var currentTargets: [URL] { var targets = FIFinderSyncController.default().selectedItemURLs() ?? [ ] if let targetedUrl = FIFinderSyncController.default().targetedURL(), t argets.count == 0 { targets.append(targetedUrl) } return targets } } ※ 編輯: bluewild (210.59.168.61), 12/26/2018 13:42:29

12/26 16:38, 5年前 , 4F
推 所以技術上可以弄個 tool 反覆對特定folder卸載
12/26 16:38, 4F

12/26 16:39, 5年前 , 5F
這樣就有機會達成選擇才下載的巨大分享目錄..
12/26 16:39, 5F

12/26 17:00, 5年前 , 6F
是這樣沒錯~我是沒改啦~就原封不動用XD
12/26 17:00, 6F

12/26 18:18, 5年前 , 7F
推推~~~
12/26 18:18, 7F

12/27 07:27, 5年前 , 8F
太神啦!
12/27 07:27, 8F

12/28 02:32, 5年前 , 9F
2TB使用者浮出水面表達感激涕零
12/28 02:32, 9F

12/28 10:01, 5年前 , 10F
10.13.6,按照步驟安裝後,工具列沒有icon,自訂裡面也
12/28 10:01, 10F

12/28 10:01, 5年前 , 11F
沒有相關選項QQ
12/28 10:01, 11F

12/28 14:51, 5年前 , 12F
實用推
12/28 14:51, 12F

12/28 20:03, 5年前 , 13F
裝完記得 killall Finder
12/28 20:03, 13F

12/30 11:50, 5年前 , 14F
雖然沒用到該需求,幫推
12/30 11:50, 14F
文章代碼(AID): #1S8kJBwy (MAC)
文章代碼(AID): #1S8kJBwy (MAC)