Answer the question
In order to leave comments, you need to log in
How to unpack several thousand *.rar archives using Bash, each archive into a separate folder?
There are many archives in a folder, each archive has several files, some of the files in the archives have the same names. Accordingly, you need to unpack these thousands of archives, each archive into a separate folder as quickly as possible.
So far I have found how to unpack the archive en masse, but then the same files are overwritten and only the last
find remains. -name '*.rar' -print0 | xargs -n 1 -0 unrar x
Answer the question
In order to leave comments, you need to log in
writing an unpack script
#!/bin/bash
find "$1" -name \*.rar -print0 | while read -d $'\0' f; do
d=`basename "$f"`
d="$2/${d/%.rar/}"
mkdir -p "$d"
cd "$d" && unrar x "$f"
done
unpack "/путь/к rar файлам" "/путь/куда распаковать"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question