-
Notifications
You must be signed in to change notification settings - Fork 1
/
splitTrainTest.sh
executable file
·25 lines (20 loc) · 1005 Bytes
/
splitTrainTest.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
#!/bin/bash
i=$((0))
find ./dataset/3_genres/ -name "*.mp3\[*\]" | while read line
do
mv "$line" ${line}$i.mp3
i=$((i + 1))
done
mkdir -p dataset/3_genres/test/pop
ls dataset/3_genres/pop | perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' | head -20 | sed "s/^/mv\ dataset\/3_genres\/pop\//" | sed "s/$/\ dataset\/3_genres\/test\/pop/" > move.sh
sh move.sh
mv dataset/3_genres/pop dataset/3_genres/train
mkdir dataset/3_genres/test/hiphop
ls dataset/3_genres/hiphop | perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' | head -20 | sed "s/^/mv\ dataset\/3_genres\/hiphop\//" | sed "s/$/\ dataset\/3_genres\/test\/hiphop/" > move.sh
sh move.sh
mv dataset/3_genres/hiphop dataset/3_genres/train
mkdir dataset/3_genres/test/rock
ls dataset/3_genres/rock | perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' | head -20 | sed "s/^/mv\ dataset\/3_genres\/rock\//" | sed "s/$/\ dataset\/3_genres\/test\/rock/" > move.sh
sh move.sh
mv dataset/3_genres/rock dataset/3_genres/train
rm move.sh