I accidentally typed

7z e archive.7z

and all the files ended up in my home directory when I wanted to extract them in a subfolder. How can I clean the mess and remove all those files?


Looking at this answer and that one in particular, I ended up running this command which removed all the unwanted files:

7z l archive.zip | awk ' {print $6} ' | awk '
  function basename(file) {
    sub(".*/", "", file)
    return file
  {print basename($1)} ' | xargs rm -rf
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.