Results 1 to 7 of 7
I am looking to uses two scripts, one to delete a file and one to restore it.
I am trying to store the pathway it originally came from and use ...
- 01-25-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
Linux delete and restore script
I am looking to uses two scripts, one to delete a file and one to restore it.
I am trying to store the pathway it originally came from and use that in the restore script. Any help would be great.
So far i have
Delete script
path=ls|find ~ -name $1
if test "$1" = ""
then echo "Provide a filename"
else mv /home/user1/$1 /home/user1/dustbin/
fi
Restore script
restorepath=$path
if test ! -n "$1"
then mv /home/user1/dustbin/$1 $restorepath
fi
- 01-26-2009 #2Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Easy. Just use the complete pathname of your file, e.g.:
Code:FILE=/my/file/to/delete mv $File /home/whatever/dustbin/$FILE
- 01-26-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
Restore
Yes i know how to delete it and send to dustbin
However when in dustbin how to send back to its original location?
- 01-27-2009 #4Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
- 01-29-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 1
well i am looking for same thing
delete and restore script,
till now what i have is that i when deleting a file we should have some sort of full path name or relative path name saved like a log
when we start restore script it looks into log file and move the to path in log file
or we can move it to place we give a name of
e.g
restore <filename> /home/user/folder
- 01-30-2009 #6
Though i'm not sure about to write script . You may be interested in my project does the same.check my site from below.
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 01-30-2009 #7Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
I believe there is a Freedesktop spec for this already. It is already implemented in Gnome (or at least in Ubuntu 8.10) as I can see the option to restore. I think the Trash bin is now seperated into a files directory and an info directory to manage this.
freedesktop.org - Specifications/trash-spec


Reply With Quote
