p7zip
p7zip copied to clipboard
Anyway to delete .7z file after successful extraction?
Hello! Exist any way or any command to delete the .7z files after a successful extraction? I need to extract a lot of .7z files that also they are bigger size and the hard disk is almost complete
In bash
for f in *.7z; do
7z x "$f"
if [ $? -eq 0 ]; then
rm "$f"
else
echo error extracting "$f"
fi
done
$? is an exit status of program - 0 means success. If 7z returns 0 it means it was successful.