SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-07-10 01:00:42

VDP76
#! Junkie
From: Bayreuth, Germany
Registered: 2012-04-12
Posts: 434

Trash-bin CLI

Today I wondered how to empty the trash bin from CLI (just for fun big_smile), I googled it and found

rm-rf /home/USER/.local/share/Trash/files/*
rm-rf /home/USER/.local/share/Trash/info/*

fine, that works.

I have also found something more, a little program called trash-cli. wink
It does more that just emptying the trash, it provides a "mild version of rm command". Files and/or folders, instead of being just deleted with rm, can be moved into the trash bin and even restored from CLI, the same way it is done in Thunar, cool! cool

So, first install the dependencies:

sudo apt-get install python python-setuptools

Then download the latest sources, unpack and install them

wget https://github.com/andreafrancia/trash-cli/tarball/master
tar xfz andreafrancia-trash-cli-xxxxxxxx.tar.gz
cd andreafrancia-trash-cli-xxxxxxxx
sudo python setup.py install

and finally use it.. smile
(the examples are taken directly from the author's README)

$ trash-put foo

$ trash-list
2008-06-01 10:30:48 /home/andrea/bar
2008-06-02 21:50:41 /home/andrea/bar
2008-06-23 21:50:49 /home/andrea/foo

$ restore-trash
0 2007-08-30 12:36:00 /home/andrea/foo
1 2007-08-30 12:39:41 /home/andrea/bar
2 2007-08-30 12:39:41 /home/andrea/bar2
3 2007-08-30 12:39:41 /home/andrea/foo2
4 2007-08-30 12:39:41 /home/andrea/foo
What file to restore [0..4]: 4
$ ls foo
foo

$ trash-empty

$ trash-empty <days>

I hope someone will find it useful!

VDP76

EDIT:
-
The program is availabilities through repositories for Waldorf, so the install is just

sudo apt-get install trash-cli

- The README file states that the program requires Python 2.7, which is not available in Statler, so I tested it in a Waldorf virtualbox and it worked well! However debian repositories indicate compatibility also with python 2.6 and indeed the program works also in Statler! big_smile

Last edited by VDP76 (2012-07-10 19:09:27)


We are a nice, friendly community here and I hope we stay that way.. smile

Offline

Help fund CrunchBang, donate to the project!

#2 2012-07-10 02:29:12

elvaqueroloco
#! CrunchBanger
From: #! Rodeo bucking chute
Registered: 2012-03-25
Posts: 121

Re: Trash-bin CLI

Very cool, @VDP! Thanks for sharing! big_smile

Last edited by elvaqueroloco (2012-07-10 02:29:31)


To say that any people are not fit for freedom, is to make poverty their choice, and to say they had rather be loaded with taxes than not. - Thomas Paine

Offline

#3 2012-07-10 06:36:01

damo
#! Die Hard
From: N51.5 W002.8 (mostly)
Registered: 2011-11-24
Posts: 653

Re: Trash-bin CLI

VDP76 wrote:

The program is written in python and requires a version higher than 2.7 so I couldn't try it in Statler, but I tested it in a Waldorf virtualbox and it worked well! cool

VDP76

In Statler, apt-get python3 (or whatever you need) and change the first line of the script to

#!/usr/bin/python3

or

#!/usr/bin/env python3 

I used to run 3 different python versions with Statler


Artwork at deviantArt; Iceweasel Personas; GDM #! Themes;
SLiM #! Themes

Offline

#4 2012-07-10 13:41:17

VastOne
#! Ranger
From: #! Fringe Division
Registered: 2011-04-26
Posts: 9,737
Website

Re: Trash-bin CLI

Very nice VDP76!

Added to Quick References


VSIDO
If you build it, they will come...
Words That Build Or Destroy

Offline

#5 2012-07-10 19:17:50

VDP76
#! Junkie
From: Bayreuth, Germany
Registered: 2012-04-12
Posts: 434

Re: Trash-bin CLI

Thanks guys!! I am glad to have contributed! big_smile

@damo It turned out that the program is compatible also with python 2.6 (see the edit in the first post), anyway thanks for the suggestion.. smile


We are a nice, friendly community here and I hope we stay that way.. smile

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo