Jump to content

Trash folder: allow browse, put back, definitely delete from Alfred search bar.


Recommended Posts

I was curious to know if I could browse the ~/Trash folder from the Alfred search bar and found I could only trigger the "Show Trash". 

 

Once you get use to navigate from folder to folder from the Alfred search bar, it is quite frustrating not being able to do it with the ~/Trash folder. 

 

Would be wonderful to be able to select then put back one or more files/folders from the Alfred search bar.

 

As I am writing this, the idea of definitely deleting a file or a folder is coming to my mind.

 

Use case? When you are notified you hard drive is full and do not want to or can't reorganise your ~/Documents, ~/Images ~/Movies ~/Music folders right away.

 

 

Link to comment
Share on other sites

11 hours ago, politicus said:

I was curious to know if I could browse the ~/Trash folder from the Alfred search bar and found I could only trigger the "Show Trash".

 

Once you get use to navigate from folder to folder from the Alfred search bar, it is quite frustrating not being able to do it with the ~/Trash folder. 

 

The correct path is ~/.Trash (note the period). You can navigate it like other directories.

 

11 hours ago, politicus said:

Would be wonderful to be able to select then put back one or more files/folders from the Alfred search bar.

 

As I am writing this, the idea of definitely deleting a file or a folder is coming to my mind.

 

Both are possible, though Put Back is hacky without accessing macOS’ APIs. Also keep in mind that not every path can be Put Back, as it depends on how they were sent to the Trash.


Here’s a Workflow that achieves a lot of what you asked. Call it with trash; further instructions are shown in subtitles.


Important notes:

  • Put Back works by showing the path in the Finder, waiting one second, and pressing ⌘⌫, which I’ll reiterate is a hacky approach. It may fail sometime, which might result in sending one of your paths to the Trash instead of recovering it. That shouldn’t be too problematic as you should me able to recover it afterwards, but it’s worth mentioning.
  • Deleting a file from the trash does just that; you won’t be able to get it back without specialised software.


While the Workflow is short on code (feel free to inspect it), you use it at your own risk. I’m providing it as a workaround for you to be able to achieve what you want right now, and while I expect it to work fine, a hacky solution is a hacky solution.

Link to comment
Share on other sites

21 hours ago, vitor said:

The correct path is ~/.Trash (note the period)

 

To add to this: Each partition has its own trash directory. If you trash something that isn’t on the boot drive, it will be in /Volume/Drive/.Trashes/NNN, where NNN is your user ID.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...