Trash & Restore Scripting Issue
Hi there, new to the forums.
I'm currently working on two scripts. The first takes a file and sens it to a folder named "Trash", as a method of file deletion. This works fine. Note this script also takes the "original file path" and stores it into a file. The 2nd script is the issue. I'm currently trying to take the file path from file and restore the file to it's original destination. I will attach both scripts for your input. Code:
echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" Code:
#!/bin/bash Thankyou very much in advance if you do take the time to assist me. I understand it's a very simplistic issue, but i'm just starting out and a little confused! |
With a couple of changes, and using only your original code, this works:
Code:
#!/bin/bash Code:
#!/bin/bash |
Code:
#!/bin/bash I had a look at this, and tested it. I actually was returned with an error. (There is a file in Trash currently called "Derp".) I did.. restore derp. In the console. I was returned with.. "find: `my-document/*': No such file or directory readlink: missing operand Try 'readlink --help' for more information. mv:cannot stat `/root/my-documents/mydir01/derp: no such file or directory Super confused :/ Is this a permissions issue? or something not quite working with the original code which is causing issues later with my restore? Thanks for your time. |
Still very eager for any assistance someone could shed? Ripping my hair out currently!
|
A friend gave me this segment of script here, which looks like it could be useful, this also doesn't work. However the error i get is one of which it claims the file cannot be moved as there is no such file or directory. I think we're getting close?
Code:
mv -i "$1$ "$(grep "$1" "$HOME/TrashLog")" |
update: after some help from other sources. I'm now at this stage..
#!/bin/bash Code:
cd "$HOME/my-documents/mydir01/Trash" || exit 1 |
All times are GMT -5. The time now is 12:45 PM. |