Created
October 9, 2013 22:55
-
-
Save cconger/6909930 to your computer and use it in GitHub Desktop.
Clean up an accidental unzip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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