Delete files in Atom under Ubuntu 16.04
Atom, Sysadmin, Ubuntu
Atom is my editor of choice - I really enjoy working in it, to the point where I even write content and prepare client reports from within Atom (I can build in git logs, write in Markdown, and convert to PDF for the client). Going back to Tiny MCE in WordPress feels horrible! Atom is free, open source and very hackable - but I recently had a problem with file deletion.
Trashing Files
When trying to delete files in Atom 1.8.0 running on Ubuntu Xenial, you may experience a problem whereby file deletion is not possible. The error message returned by Atom suggests that gvfs-trash
is not installed:
The following file couldn’t be moved to trash (is gvfs-trash installed?)
Debugging Steps
Check that gvfs-trash is working by opening a terminal & moving to a development directory - in this case, var/www/html/devsite
- and attempting to delete a file:
This gives a clue - it looks like:
- Atom uses
gvfs-trash
to send files to Trash on delete - When the file to be deleted is located outside the home directory, there is a problem - the
gvfs-trash
process fails
It would be good if Atom could return the gvfs-trash
error message, as this gives just enough information to hint towards a solution.
Solution
Create a new Trash directory that can be accessed from outside the user’s home directory:
That’s it - problem solved!
The answer had been staring me in the face for weeks - some of my repos are in my home directory (mainly BASH scripts and system utilities) and files in these directories were deleting without issue. It didn’t dawn on me that the issue only cropped up in my Apache doc root (/var/www/html/*
). Facepalm.
Posting this here to prevent repeating myself the next time I set up a development environment.
Resources
Useful gvfs-trash
Commands
comments powered by Disqus