fant0men

Find 7zip / rar / zip archives and see which ones contain C / C++ source files

Aug 21st, 2020 (edited)
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. find . -type f -iname "*.7z" -o -iname "*.rar" -o -iname "*.zip" | while read f; do if [[ $f =~ .7z$ ]]; then 7za l "$f" 2>&- | grep -Eq '(\.c$)|(\.cpp$)' && echo "$f"; elif [[ $f =~ .rar$ ]]; then rar lb "$f" | grep -Eq '(\.c$)|(\.cpp$)' && echo "$f"; elif [[ $f =~ .zip$ ]]; then 7za l "$f" 2>&- | grep -Eq '(\.c$)|(\.cpp$)' && echo "$f"; fi; done
RAW Paste Data