Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rjeczalik/ff651c4d82a5ab6b76e5 to your computer and use it in GitHub Desktop.
Save rjeczalik/ff651c4d82a5ab6b76e5 to your computer and use it in GitHub Desktop.
bash-trick-01: WHY U NO ARCHIVE DIR?

unzip-all-the-things

~/Downloads $ wget https://mega.co.nz/sdk.zip &>/dev/null
~/Downloads $ unzip sdk.zip 
Archive:  sdk.zip
  inflating: readme.txt              
  inflating: megabdb.cpp             
  inflating: megacli.cpp             
  inflating: megaclient.cpp          
  inflating: megacrypto.cpp          
  inflating: megaposix.cpp           
  inflating: megawin32.cpp           
  inflating: megabdb.h               
  inflating: megaclient.h            
  inflating: megacli.h               
  inflating: megacrypto.h            
  inflating: mega.h                  
  inflating: megaposix.h             
  inflating: megawin32.h             
  inflating: Makefile                
  inflating: Makefile.win32

fuuuuuuuuuuuuuuuuuuu

~/Downloads $ while read f; do rm -v $(sed -e's/.*\:\s\(.*\)/\1/' <(echo $f)); done < <( cat <<EOF
>   inflating: readme.txt              
>   inflating: megabdb.cpp             
>   inflating: megacli.cpp             
>   inflating: megaclient.cpp          
>   inflating: megacrypto.cpp          
>   inflating: megaposix.cpp           
>   inflating: megawin32.cpp           
>   inflating: megabdb.h               
>   inflating: megaclient.h            
>   inflating: megacli.h               
>   inflating: megacrypto.h            
>   inflating: mega.h                  
>   inflating: megaposix.h             
>   inflating: megawin32.h             
>   inflating: Makefile                
>   inflating: Makefile.win32
> EOF
> )
removed ‘readme.txt’
removed ‘megabdb.cpp’
removed ‘megacli.cpp’
removed ‘megaclient.cpp’
removed ‘megacrypto.cpp’
removed ‘megaposix.cpp’
removed ‘megawin32.cpp’
removed ‘megabdb.h’
removed ‘megaclient.h’
removed ‘megacli.h’
removed ‘megacrypto.h’
removed ‘mega.h’
removed ‘megaposix.h’
removed ‘megawin32.h’
removed ‘Makefile’
removed ‘Makefile.win32’

not-bad

// TODO explain

are-you-a-wizard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment