Skip to content

Instantly share code, notes, and snippets.

@keiya
Created May 22, 2015 11:50
Show Gist options
  • Select an option

  • Save keiya/7ca04db707b938542157 to your computer and use it in GitHub Desktop.

Select an option

Save keiya/7ca04db707b938542157 to your computer and use it in GitHub Desktop.
Progressive extractor of compressed files (arc, zip, lzh, 7z, rar); requires unar (The UNARchiver); tested on Windows 8.1
#!/bin/bash
UNAR='/cygdrive/d/apps/unar/unar.exe'
find "$1" -type f \( -iname "*.lzh" -o -iname "*.arc" -o -iname "*.zip" -o -iname "*.7z" -o -iname "*.rar" \) -print0 | while IFS= read -r -d '' fullfile; do
fullpath=$(readlink -f "${fullfile}")
fulldir=$(dirname "${fullfile}")
$UNAR -t -o "${fulldir}" "${fullfile}" && rm -f "${fullfile}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment