[ANN] Trash.jl

Trash.jl

Finally, a package that’s absolute garbage

The need to delete files comes up a lot, and it’s easy to reach for rm for that. However, sometimes there’s a chance that your program or a user will want to be able to recover a file. What’s a good way to handle this? Why just trash the file!

At the end of the initial development of BaseDirs.jl I came across the FreeDesktop Trash specification and discovered that no package implementing it in Julia existed. In my foolish naivety I though “that looks pretty easy to implement” and began to tumble down this rabbit hole. Of course Mac and Windows have their own way of doing things, and the whole point of this is to re-use the existing platform machinery…

A few weeks ago I passed by the half-finished code for the last time and thought I’d finish this project off. By some miracle, despite me having no immediate use for this package, I seem to have ended up creating the most feature-complete cross-platform trashing library (as of the time of writing).

Trash.jl doesn’t just support trashing files, it also supports:

  • examining the trash
  • untrashing files
  • permanently removing trashed files
  • detecting orphaned files and metadata in the trash (from other poorly behaved programs or manual poking at the system trash)
  • emptying the trash

A few existing trashing libraries for other languages are this comprehensive, but only for a single operating system. Trash.jl provides a uniform interface to these capabilities across Linux, BSD, Mac, and Windows.

Enjoy!

54 Likes