LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2010, 12:18 PM   #1
KonfuseKitty
LQ Newbie
 
Registered: Jul 2010
Distribution: Ubuntu 10.10
Posts: 22

Rep: Reputation: 0
Question 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.
 
Old 07-10-2010, 12:44 PM   #2
KonfuseKitty
LQ Newbie
 
Registered: Jul 2010
Distribution: Ubuntu 10.10
Posts: 22

Original Poster
Rep: Reputation: 0
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.
 
  


Reply

Tags
bash, delete, move, mv, script, trash



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
Lost disk space after deleting files, trash, hidden trash, etc. themacguy Ubuntu 7 06-06-2012 02:51 AM
[SOLVED] Bash script needed to move files to another folder. No_one_knows_me Linux - General 28 01-07-2010 10:29 PM
Bash script: Move files, ignore case Fredde87 Linux - Software 3 09-03-2008 03:34 AM
After a piece of software/a bash script to mass-move files [Fedora Core 6] Alux Linux - Desktop 3 11-23-2006 02:33 PM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:19 PM.

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