LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 09-18-2006, 12:51 PM   #1
rshields9093
LQ Newbie
 
Registered: Sep 2005
Posts: 16

Rep: Reputation: 0
Question How to send file to KDE trashcan via CLI?


Well, that's the simple question. Can I use the command line to send a file to KDE's (3.4) trash can? It seems that KDE is using a particular protocol (trash:/) for this purpose but I can't figure out how to do anything with it via the CLI.

Thanks,

Robert

Last edited by rshields9093; 09-18-2006 at 01:30 PM.
 
Old 09-18-2006, 02:19 PM   #2
zetabill
Member
 
Registered: Oct 2005
Location: Rhode Island, USA
Distribution: Slackware, Xubuntu
Posts: 348

Rep: Reputation: 32
It's probably not a fantastic idea to do it but possible. Generally the trash "function" moves the files to a trash folder and then stores information about where it originally was, permissions, etc. So it's a perfect candidate for a protocol. It's probably not too difficult a task to accomplish but it probably won't be as effective as using it in KDE.

Your best bet would be to make your own CLI trash can (mkdir ~/.cli-trash) and then write a bash script that mimicks the rm command but actually uses the mv command to move it to .cli-trash. You could call it trash.. but not rm. Then you could make a script that empties that folder, etc, etc. The real challenge is restoration. Simply moving it to a trash folder means you can't just restore it but actually move it again to where you want it.

With that being said, getting to use the KDE trash can is basically the same thing. You would have to write a trash script that moves it to KDE's trash can and that doesn't necessarily mean that restoration is easy. It might be possible to find the process KDE uses for the trash protocol and either mimick it or possibly use it directly. I can't see how this would be possible without a little KDE hacking... it's a builtin function.

Maybe someone has cracked this and could give their opinions or maybe you could poke around the KDE fora to see if this has been discussed there.

Good luck.
 
Old 09-19-2006, 09:33 AM   #3
rshields9093
LQ Newbie
 
Registered: Sep 2005
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks for the reply. I was of course hoping that there was some CLI way to directly access the KDE trash function. But if not, I think maybe your suggestion of making my own cli-trash might be the best route for me. I will poke around a bit more as you suggest, but sounds like I might have a little hobby for this upcoming weekend.

Thanks again for the help.

Robert
 
Old 09-20-2006, 08:07 AM   #4
hand of fate
Member
 
Registered: Nov 2003
Distribution: Mandriva
Posts: 441

Rep: Reputation: 31
I've had a look at what sending something to trash from KDE actually does, and it seems fairly simple.

First is moves the file into the directory ~/.local/share/Trash/files.

Then it creates a plain text file caled {file name}.trashinfo in ~/.local/share/Trash/info, containing the text

Code:
[Trash Info]
Path=original path of file
DeletionDate=year-month-dayThour:minute:second
Obviously the bits I've written in blue need to be replaced with the correct information, everything else is written exactly as I've writen it here. Note that the file ends with an empty line.


I can't help you with the coding, but it should be fairly straight forward to create a script that can do that.

Last edited by hand of fate; 10-03-2006 at 10:43 AM.
 
Old 10-02-2006, 09:08 PM   #5
rshields9093
LQ Newbie
 
Registered: Sep 2005
Posts: 16

Original Poster
Rep: Reputation: 0
ah ha. Thanks for the info on how KDE handles trash. That appears to be quite simple and even I ought to be able to code something to handle that. Thanks again for the info. Now I have a little project to work on.
 
Old 10-06-2006, 12:29 AM   #6
grepper
LQ Newbie
 
Registered: Oct 2006
Posts: 4

Rep: Reputation: 0
You can accomplish this with kfmclient.
Code:
kfmclient --commands
will give you help.
trash is protocol in kde
ie. putting
Code:
trash:/
in konqueror will bring up your trash
(no pun intended)

anyway, here it is:
Code:
kfmclient move your_file trash:/
hth,
grepper
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MDV06, KDE 3.4.2 will only shutdown through CLI. Lordandmaker Linux - Newbie 1 12-05-2005 12:32 AM
Installing x-window and kde from CLI mattp Linux - Software 2 10-03-2005 09:07 AM
Trashcan into KDE Taskbar (like ubuntu) jmikeneedham SUSE / openSUSE 2 07-27-2005 07:54 AM
Samba works in CLI but not using KDE or SMB4K enryfox Linux - Software 3 04-21-2005 05:36 PM
CLI to Gnome terminal, in KDE.? Carpinus Linux - Newbie 11 03-08-2005 10:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 06:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration