Skip to content

Instantly share code, notes, and snippets.

@miraculixx
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miraculixx/511d9bdc1e6cbaedd538 to your computer and use it in GitHub Desktop.
Save miraculixx/511d9bdc1e6cbaedd538 to your computer and use it in GitHub Desktop.
remove files extracted from a zip file
#!/usr/bin
# Purpose:
#
# you have unzipped a zip file and realise the files are in the wrong place?
# simply remove the files again using this command
#
# Usage: cleanzipextract <zipfile>
#
# WARNING: this will list all files and then unconditionally remove all files it finds
# USE WITH CAUTION
#
# PROVIDED AS IS, THIS IS NOT FIT FOR PURPOSE, ANY WARRANTY EXLUCDED
#
unzip -l $1 | cut -c30-250 | grep -v "\-\-" | head -n-1 | tail -n+3 | xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment