Looking for a way to:

Move several files to the Mac trash in terminal without using the rm, crazy regex,finder, or something destructive.

Today I realized I was just asking the wrong question.

Once I figured out it was just moving several files to "another directory" (in my case ~/.trash), this result came up in Unix & Linux.

I've modified a find command harvested there for my needs...

Continuing with the .zip example: Once you're in the parent directory, just run... find . -name '*.zip' -exec mv {} ~/.trash \;

My question is... Is there a way to do it with the trash plugin which has it's advantages like keeping "put back" alive?

Thanks in advance.

  • I'm pretty sure there's a "trash" command available via brew, have you checked that out? – At0mic May 19 '20 at 0:48
  • Your comment had me digging around a bit more. I'm going to uninstall "trash" plugin and try "trash CLI" it looks like it's better at taking expressions. github.com/sindresorhus/trash-cli – Chrisdigital May 19 '20 at 1:44
  • Good news, bad news. I figured out the command to use with the plugin. It's not shorter because you need the path to the executable. It doesn't perserve "put back" (maybe it's how Catalina works.) I did however switch to the homebrew version for better maintenance. formulae.brew.sh/formula/trash Here's how the command would go... ` find . -depth -name '*.zip' -exec /usr/local/bin/trash {} \;` – Chrisdigital May 19 '20 at 3:55
  • The new line came from clues in this somewhat related post: stackoverflow.com/questions/5590375/… – Chrisdigital May 19 '20 at 4:01
  • If it doesn't preserve the Put Back function of Move to Trash from Finder, why even use a third-party utility? – user3439894 May 19 '20 at 4:03

You must log in to answer this question.

Browse other questions tagged .