I try to rebuild missing .part rar files
For example I have these files
in the rain.part01.rev
in the rain.part02.rar
in the rain.part02.rev
in the rain.part03.rar
...
you can see that part01.rar
is missing, so I need
- rebuild part01.rar
- check and repair corrupted files
I try with this bash script but doesn’t work
#!/bin/bash
echo “Starting script…”
# Loop over all .rar files in the current directory
for file in *part*1.rar *part*01.rar
do
echo "Processing file $file..."
# Extract the part number from the file name
part_number=$(echo $file | cut -d '.' -f 2)
# Remove all occurrences of "part" from the part number
part_number=${part_number//part/}
# If the part number is 1 or 01, run rar with the r command on the file
if [ "$part_number" == "1" ] || [ "$part_number" == "01" ]; then
echo "Reconstructing archive $file"
rar r $file
fi
done
echo "Script finished."