8

I have a small SSD so I keep most of my files on iCloud and download only those files and folders I am working on. When I want to remove downloads from my Mac I right-click on a folder and select "Remove Download" but not all subfolders and files are removed, and I have to open each one up to remove them.

How can I select a high level folder and remove ALL downloaded subfolders and files in one command?

3
  • 1
    You need to be carful doing this. iCloud is a synchronisation service, not on online storage service. Throwing one file away can easily result in all copies on all sync'd devices also being thrown out. [I can't provide a detailed answer because it's a structure I don't use - partly for this reason.]
    – Tetsujin
    Oct 23, 2021 at 9:28
  • However iCloud does manage the scenario you have stated you don't need to manually delete files etc. It is optimise mac storage support.apple.com/en-gb/guide/system-information/sysp4ee93ca4/… However as Tetsujin says then you do not have a backup of the files
    – mmmmmm
    Oct 23, 2021 at 10:23
  • So I am not talking about deleting files, just removing downloads from my computer, specifically folders, to optimise storage, which is in iCloud's design. It's just that iCloud leaves the subfolders on my computer, and I have to go through each one to remove that download as well.
    – Jack
    Oct 23, 2021 at 12:37

5 Answers 5

10

I also had this question and was struggling to find an answer for a while. I did find a solution from "Rakhesh" on another website finally. Apple needs to just make this option available in Finder, but at least this is possible from Terminal. In Finder, right click the top-level folder you want to have all subfolders and files undownloaded and click "new terminal at folder". Then issue this command:

find . -type f -exec brctl evict {} \;
1
  • How can you undo this and force all files to download instead?
    – Render
    Sep 20 at 12:24
2

I agree with Korey's solution, but I have updated it a bit by using Automator!

create automator quick action iCloud remove downloads recursively remove all iCloud downloads

Setup: Open Automator. Create a new Quick Action.

Set "Workflow receives current" to "folders" in "Finder".

Drag in a "Run Shell Script".

IMPORTANT: Change "Pass input" to "as arguments"

Paste in the following code:

cd $1
find . -type f -exec brctl evict {} \;

Save (CMD+S). I saved mine as "Remove Downloads (Recursively)"

Using:

This will automatically be available under the Quick Actions menu. Simply select the folder, right click (CTRL+click), and the Quick Actions menu is near the bottom. You can also press CMD+SHIFT+P to toggle the preview window. You should see the action in the bottom right of your screen.

create automator quick action iCloud remove downloads recursively remove all iCloud downloads

However, I found it most useful to add a keyboard shortcut. This is a little different in macOS 13 (Ventura) and I personally hate it, but you can search the system settings for "keyboard shortcut". A new box will appear. Navigate to the "Services" tab and then the "Files and Folders" drop-down. Double-click where it says "none" and add your shortcut. I first tested a few shortcuts in Finder until I found one that prompted the "error sound".

NOTE: After you save your shortcut, close settings and "Relaunch" finder (simply OPTION+right_click or OPTION+CTRL+click finder and click "Relaunch". Otherwise, it doesn't work!

create automator quick action iCloud remove downloads recursively remove all iCloud downloads

Now, I simply select the folder and press CMD+OPTION+R and it works. This is awesome!

create automator quick action iCloud remove downloads recursively remove all iCloud downloads

Explanation: The "New Terminal at Folder" essentially is a "cd /path/to/folder" as the first line in the new terminal window. We've replaced this with passing in the action of selecting a file/folder. Thus, as long as we pass in the path to the folder, it should work just fine.

0

I found a way someone mentioned here but was not completely understood. It's built in, no need to code or modify anything.

  • Open Finder, go to your big, fat folder.
  • Switch to column view (command 2)
  • Select all files (command a)
  • Press OPTION RIGHT ARROW on your keyboard. All folders will open. Give it time.
  • THEN do "command a" to select all
  • OPTION RIGHT CLIC and select "remove downloads"

That's it

0

To do this for other cloud storage services like Google Drive, you can run fileproviderctl evict <path>.

To do it using the context menu, you can try this shortcut I made.

Right-click folder, Quick Actions > Remove Sub-downloads

To run the shortcut, you need to enable "Allow Running Scripts" in the Shortcuts app's preferences.

Preferences > Advanced > Allow Running Scripts

Here's the shortcut setup:

Screenshot of Shortcut setup

-1

There's much easier way. Select everything in Finder that contains any random mix of offline/online files, that eventually you want to free space from. Right click with Option key. Download Now becomes Remove Downloads. Voila!

4
  • This does not answer the question. The owner of the question is already aware that s/he can select multiple files and choose the Remove Downloads option from the context menu. The question is about how s/he can do that without having to choose each and every related file.
    – Alper
    Jun 11 at 10:34
  • Without selecting each and every mean two things: 1. selecting all and processing one way or another in a single shot 2. doing that automatically — without user interaction. The first option is to select all and do just one action with or without Option pressed.
    – Maxiller
    Jun 12 at 6:24
  • Thx but your answer still does not seem to help. Exactly how do you suggest someone accomplishes to select multiple files in different folders at once by “selecting all”?
    – Alper
    Jun 12 at 7:14
  • Looking at the question, I assume you haven’t tried, have you? iCloud may be thought of as a mount point. Everything goes below it. One should simply expand top level folder which they want to free space from, make sure at least one downloaded file is directly selected and then do what suggested.
    – Maxiller
    Jun 13 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .