forked from junrar/junrar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-testdata.sh
81 lines (68 loc) · 1.34 KB
/
generate-testdata.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
mode=$1
adstepping=$2
t1stepping=$3
t2stepping=$4
indir=$5
outdir=$6
par1=1
par2=1
path=$PWD
function start {
case "$1" in
a|d)
.
while [ $par1 -le 31 ]
do
rar a -ep1 -mc$par1$1+ $path/$outdir/$i/$i-mc$par1$1+.rar $path/$indir/$i
let par1+=adstepping
done
par1=1
;;
t)
let par1=2
while [ $par1 -le 63 ]
do
while [ $par2 -le 128 ]
do
rar a -ep1 -mc$par1:$par2$1+ $path/$outdir/$i/$i-mc$par1.$par2$1+.rar $path/$indir/$i
let par2+=$t2stepping
done
let par1+=$t1stepping
let par2=1
done
par1=1
;;
c|e|i)
rar a -ep1 -mc$1+ $path/$outdir/$i/$i-mc$1+.rar $path/$indir/$i
par1=1
;;
n)
rar a -ep1 -mca- -mcd- -mct- -mcc- -mce- -mci- $path/$outdir/$i/$i-n.rar $path/$indir/$i
;;
esac
}
if [ "$mode" != "" ] && [ "$adstepping" != "" ] &&[ "$t1stepping" != "" ] && [ "$t2stepping" != "" ] && [ "$indir" != "" ] && [ "$outdir" != "" ];
then
# create output dir
mkdir -m 0777 $outdir
cd $indir
for i in $(ls *)
do
mkdir -m 0777 $path/$outdir/$i
if [ "$1" == "all" ];then
start a
start d
start c
start e
start i
start t
start n
else
start "$mode"
fi
done
else
echo "usage: ./generate-testdata.sh [ a | d | c | e | i | t | n | all ] [ adstepping ] [ t1stepping] [ t2stepping] [ indir ] [ outdir ]"
echo .......................................
exit 0
fi