LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Bash script: how to move files to Trash instead of deleting? (http://www.linuxquestions.org/questions/programming-9/bash-script-how-to-move-files-to-trash-instead-of-deleting-819103/)

KonfuseKitty 07-10-2010 01:18 PM

Bash script: how to move files to Trash instead of deleting?
 
I've tried a number of suggestions found on the internet and none of them work. Here's one:

Code:

mv "$x" ~/.Trash/
...where $x is the pathname of the file passed to the script. I've also tried different paths to Trash - on Desktop, in Home folder, in my user folder, it makes no difference. Either nothing happens, or more often, the file is simply copied to my desktop or userfolder with the name "Trash".

What is the actual path to the Trash folder and how can I move files there? I'm using Ubuntu 10.04.

KonfuseKitty 07-10-2010 01:44 PM

Solved! :)

Code:

mv "$x" /home/YOURUSERFOLDER/.local/share/Trash/files/
...where YOURUSERFOLDER is like it says. And that does it, the file is in the Trash!

I hope this helps someone else out there, as I've not seen this solution anywhere, despite a lot of searching.


All times are GMT -5. The time now is 02:52 AM.