Making a split volume .rar and deleting the source file

173 Views Asked by At

I've got a small problem. I have a folder with a bunch of files. Each of these need to be put into it's own .rar volume that is split into 50MB pieces. The problem is there are a couple of hundred files and I don't have enough disk space for both the source files and the newly created split files. I've found out how to do each one singly, but I'm hoping someone out there knows a way to automate the whole process. If possible I'd rather not spend the next few weeks going through the process of making the new volumes and deleting the source file for each one of them.

I'm trying to run this on CentOS 6. Thank you very very much!

1

There are 1 best solutions below

0
On BEST ANSWER

I spent the last few days learning about bash scripts and figured out a solution

!#/bin/bash
for f in *.7z
do
fbname=$(basename "$f" .7z)
echo "$fbname"
echo "Split raring $fbname"
rar a -v52480 -m0 "$fbname.rar" "$fbname.7z" && rm -rf "$fbname.7z"
done

You could modify .7z to the extension of the files you are trying to use. In my case I just needed them split into rar files for Usenet purposes. If you were wanting to initially comporess them then you would change the -m argument to a number between 1 and 5.