Jump to content
Gonzalez

[Linux] Rar files into X size splits

Recommended Posts

#!/bin/bash
#Author: Avek
#Add all files/folders from folder to different archives
#Delete files/folders after successfully adding to rar
#Split to volume set in mb by user - 1st option eg
#./script 10 = 10mb splits Standard size = 100 mb

if [ $1 ]; then
SIZE=$(($1 * 1024))
else
SIZE=$((100 * 1024))
fi
Sname=`echo $0 | sed 's/.\///g'`;

for x in *
do
if [ "$x" == "$Sname" ]; then
echo -ne;
elif [ -d "$x" ] || [ -e "$x" ]; then
rar a -df -m0 -v"$SIZE"k "$x".rar "$x"
fi
done

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...