Recently my NAS was ransomware attacked and all my files were 7z
ipped. I managed to get the password and extract them and at the same time I renamed the 7zipped file to 7z.bad
(so that it's easier later to delete just the affected files and not any actual .7z
files I already had before the attack).
This is the script I used to extract and rename the files:
while [ -n "$(find . -type f -name '*.7z' -print -quit)" ]
do
find . -type f -name "*.7z" -execdir /usr/local/sbin/7z x -pPASSWORD {} \; -execdir mv {} {}".bad" \;
done
So, what I have now is a lot of duplicates, like this:
Phone book.xlsx
Phone book.xlsx.7z.bad
What I would like to do is:
- Look for any
.7z.bad
files in the current directory (and all subdirectories) - For any
.7z.bad
file found, if the same file without .7z.bad extension is also present: - Delete the
.7z.bad
file
The reason I want to check for the original file's presence is just for another level of security.
I am afraid I won't be able to install any other tools (like fdupes
) in my Qnap NAS.