Skip to content

Instantly share code, notes, and snippets.

@cconger
Created October 9, 2013 22:55
Show Gist options
  • Save cconger/6909930 to your computer and use it in GitHub Desktop.
Save cconger/6909930 to your computer and use it in GitHub Desktop.
Clean up an accidental unzip
#unzip -qqql $ZIPFILE
# -l lists all the files and directories in the zipfile without extracting them
# -qqq removes all the extra output (size summaries)
# tr -s ' '
# Removes the extra spaces which unzip uses to make the output human readable
# cut -d ' ' -f 5
# Splits the input on spaces and selecst the 5th element (the filename)
# xargs rm -rf
# applies all the filenames to the command rm -rf to delete them
unzip -qqql $ZIPFILE | tr -s ' ' | cut -d ' ' -f 5 | xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment