-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_train_split
More file actions
executable file
·47 lines (46 loc) · 860 Bytes
/
Copy pathtest_train_split
File metadata and controls
executable file
·47 lines (46 loc) · 860 Bytes
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
#!/bin/bash
if [ "$1" == "test" ]; then
echo pruning test set
cd test
for dir in `ls -d *`
do
cd $dir
echo $dir
for file in `ls *`
do
number=`echo "$file" | awk -F'.' '{ print $1 }'`
parse_fail=`file "$file" | grep -e RIFF -e gzip -e HTML | wc -l`
if [ "$number" -ge "100" ]
then
\rm -rf "$file"
elif [ "$parse_fail" -gt 0 ]
then
\rm -rf "$file"
fi
done
cd ..
done
elif [ "$1" == "train" ]; then
echo pruning training set
cd train
for dir in `ls -d *`
do
cd $dir
echo $dir
for file in `ls *`
do
number=`echo "$file" | awk -F'.' '{ print $1 }'`
parse_fail=`file "$file" | grep -e RIFF -e gzip -e HTML | wc -l`
if [ "$number" -lt "100" ]
then
\rm -rf "$file"
elif [ "$parse_fail" -gt 0 ]
then
\rm -rf "$file"
fi
done
cd ..
done
else
echo "usage: $0 [test | train]"
fi