This forum has been archived. All content is frozen. Please use KDE Discuss instead.

sending a file to Trash from command line

Tags: None
(comma "," separated)
yuvalaviel
Registered Member
Posts
1
Karma
0
OS
Hi,

Is there a way of sending a file to Trash from command line?

I want to have KDE's "Restore" capability when deleting a file from command line.

thanks,
yuval.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Unfortunately it is a little more complicated than just moving the file. The file needs to be moved to ~/.local/share/Trash/files while ensuring no file of the same name already exists, and a ~/.local/share/Trash/info/<new name>.info file needs to be created. If the info file does not exist, then the file will not be shown.

Example info file:
Code: Select all
[Trash Info]
Path=/home/trunk/Zenwalk.png
DeletionDate=2009-04-11T23:15:42


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
You can do this with the following command:

Code: Select all
kioclient move 'file' trash:/

where 'file' is the file you want to trash

See also ktrash4 for restoring or emptying the trash from command line.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]