Skip to content

Instantly share code, notes, and snippets.

@fabioyamate
Created May 14, 2012 03:26
Show Gist options
  • Save fabioyamate/2691607 to your computer and use it in GitHub Desktop.
Save fabioyamate/2691607 to your computer and use it in GitHub Desktop.
One line script to extract multiples rar files, with historic of ones already extracted
# Extract multiple rar files in subdirs from torrent files
#
# it doesn't extract files that have been previously. Always run the script file in
# the same dir as extrected.list, since it store path
#
# 1. ls **/*.rar - look up to any rar files in sub dirs
# 2. ignores all files that matches ones in the extracted.lst file
# 3. appends the non-extracted files to the lst file
# 4. for each rar file, extract them in the current directory
#
# requirements:
# - bash with glob list support
# - unrar bin
#
# TODO:
# - deal with possible errors
# - correct extracted file names, if don't matched the same as directory name
# - move ls to find version, like 'find . -name "*.rar"'
ls **/*.rar | grep -v -f extracted.lst | tee -a extracted.lst | xargs -n 1 unrar e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment