Skip to content

Instantly share code, notes, and snippets.

@theagoliveira
Created October 11, 2019 05:56
Show Gist options
  • Save theagoliveira/1aca16cde58250b9aec82c3afabb10c6 to your computer and use it in GitHub Desktop.
Save theagoliveira/1aca16cde58250b9aec82c3afabb10c6 to your computer and use it in GitHub Desktop.
Extract every rar file inside a directory and compress as a zip file
#!/bin/bash
#
# Author: Thiago Cavalcante
# github.com/theagoliveira
find . -maxdepth 5 -mindepth 1 -name "*.rar" -type f -execdir unrar x -ad {} \; -exec bash -c 'f="{}"; f=${f::-4}; 7z a -tzip "$f.zip" "$f"; rm -rf "$f"' \; -exec rm -f {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment