View Full Version : [SOLVED] Command Line trash utility - Supports Restore AND handles spaces ;-)
jcllings
Jan 24th 2010, 03:34 AM
Check it out. It's on my Wiki. ;D
http://developershed.wikia.com/wiki/BASH_Scripting
kubicle
Jan 24th 2010, 06:44 AM
There is of course no harm in writing your own tools, but there is also a 'trash-cli' utility available in the repositories:
This package provides a command line interface trashcan utility
compliant with the FreeDesktop.org Trash Specification. It remembers
the name, original path, deletion date, and permissions of each trashed
file
It includes commands 'trash', 'list-trash', 'restore-trash' and 'empty-trash'
Telengard
Jan 24th 2010, 02:16 PM
It looks like you put an awful lot of work in that, and it is quite impressive. It looks like you are doing all the accounting work by hand too, not just simply moving to the trash folder.
The script which developed from the thread Command line trash bin access (http://kubuntuforums.net/forums/index.php?topic=3104953.msg192141#msg192141) also supports restore and handles filenames with spaces. It doesn't need to do the accounting because it calls a higher level KDE function to do the dirty work. The downside is that it doesn't seem to work in Kubuntu 9.04 Jaunty Jackalope or later.
As kubicle said, most people will want to simply use trash-cli (http://packages.ubuntu.com/search?keywords=trash-cli&searchon=names&exact=1&suite=all§ion=all). If trash-cli had been in the 8.04 Hardy Heron repos then I would not have bothered writing my own trash script.
verndog
Jan 24th 2010, 03:31 PM
Check it out. It's on my Wiki. ;D
http://developershed.wikia.com/wiki/BASH_Scripting
jcllings, you might want to add how to use your script on you wiki page. Some examples would help also.
Snowhog
Jan 24th 2010, 05:43 PM
It includes commands 'trash', 'list-trash', 'restore-trash' and 'empty-trash'
Very nice! Did not know about this little gem. Now one can have that 'safety net' when working from the CLI and doing house cleaning (removing files) that most of us have been working without.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.