I'm working on a Recycle Bin script which I can call to delete a file and restore a file.
The delete currently works fine and can be called using a wildcard, filename (for current directory) or a full filepath entirely. It then takes this file and stores it in /root/Dustbin/...
# del example.txt
While doing this it also stores the original filepath in a log.txt file in the Dustbin.
Now my question is this - how would I go about restoring the file to it's original location (which is stored in the log.txt file)?
My code for restore is currently:
#!/bin/sh
for path in "$@"; do
find /root/Dustbin -name "$path" -exec mv {} ./ \;
done
#End of script
At the moment this restores the file specified from Dustbin to my current location using
# restore example.txt
Thanks