Created
January 28, 2026 22:11
-
-
Save kemelzaidan/5c385203bb2c2805b10288c7778208cb to your computer and use it in GitHub Desktop.
converts 7z files to rvz ones
This file contains hidden or 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
| #!/bin/bash | |
| shopt -s nullglob | |
| for file in *.7z; do | |
| echo "----------------------------------------------" | |
| echo "Processing: ${file}" | |
| DEST=".torvz_${file%.*}" | |
| # 1. Extração com progresso filtrado | |
| echo -n "Extracting: " | |
| #TODO: filtering progress is not working properly | |
| 7z x "${file}" -o"${DEST}" -y 2>&1 | grep -oP '\d+%' | while read -r prog; do | |
| # echo -ne "\rExtracting: $prog" | |
| done | |
| echo -e "\rExtracting: 100% - Done! " | |
| # 2. Localização da ISO | |
| ISO_PATH=( "${DEST}"/* ) | |
| ISO=$(basename "${ISO_PATH}") | |
| RVZ_OUT="./${ISO%.*}.rvz" | |
| # 3. Dolphin Tool (Silencioso) | |
| echo "Converting to RVZ..." | |
| ./Dolphin_Emulator-2512-anylinux-x86_64.AppImage dolphin-tool convert \ | |
| -i "${DEST}/${ISO}" \ | |
| -o "$RVZ_OUT" \ | |
| -f rvz -s -b 131072 -c zstd -l 5 > /dev/null 2>&1 | |
| # 4. Coleta de dados | |
| ORIGINAL_SIZE_H=$(du -h "${DEST}/${ISO}" | cut -f 1) | |
| RVZ_SIZE_H=$(du -h "$RVZ_OUT" | cut -f 1) | |
| ISO_SIZE_B=$(stat -c%s "${DEST}/${ISO}") | |
| RVZ_SIZE_B=$(stat -c%s "$RVZ_OUT") | |
| RATIO=$(echo "scale=4; $RVZ_SIZE_B / $ISO_SIZE_B" | bc | sed 's/^\./0./') | |
| PERC=$(echo "scale=2; (1 - ($RVZ_SIZE_B / $ISO_SIZE_B)) * 100" | bc) | |
| # 5. Relatório | |
| cat <<- EOF | |
| ============================================== | |
| CONVERSION REPORT: | |
| ============================================== | |
| File: $ISO | |
| Original Size: $ORIGINAL_SIZE_H | |
| RVZ Size: $RVZ_SIZE_H | |
| Ratio: $RATIO | |
| Reduction: $PERC% | |
| ============================================== | |
| EOF | |
| # 6. Limpeza | |
| rm -rf "${DEST}" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment