how do i write a bash script to restore deleted files to original location?
Hi
I have managed to write a bash script that moves files to the recylce bin instead of being deleted. Then (with a bit of assistance) wrote another bash script that deletes the files from the recycle bin. Now I need to write one that will restore the files preferably to their original location? I am very new to linux and stuggling with where to even begin...any ideas? There seems to be some advice about creating a cloning tree, but I've never heard of them? Would much appreciate a little pointer to get me started. |
So do you want to restore them before or after they've been removed from the recycle bin?
|
After they have been deleted. Is it even possible? Thanks
|
Quote:
Quote:
|
Quote:
|
After they have been deleted? Is it even possible; maybe with lsof and grep? I'm just thinking of possible ways to manage it. Not getting very far unfortunately.
|
Quote:
Quote:
You don't want a "dustbin" nor a kludge to manage it: you want either libtrash or (rsync-based) backups. |
At present I have scripts that
1. move files to the dustbin 2. empty the dustbin is it possible then maybe to store the file elsewhere, maybe in a temp file, as well as moving it to dustin and then I could restore from there? Sorry about not starting a new thread and not adding to my old one and thanks for putting on the link :-) |
You can create as many copies as you want, wherever you want, but once you physically delete a (copy of) a file, that copy is gone. It's very hard & unreliable to attempt to recover them. Use backups instead.
|
All times are GMT -5. The time now is 04:35 PM. |