-
Notifications
You must be signed in to change notification settings - Fork 0
/
move_files.sh
executable file
·90 lines (71 loc) · 2.02 KB
/
move_files.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
79
80
81
82
83
84
85
86
87
88
89
90
# Moving Large data.
# sourceFolder="./yolov5/data/train/images"
# destinationFolder="./complete_data/images/"
# # Create the destination folder if it doesn't exist
# mkdir -p "$destination_folder"
# # Move files one by one
# for file in "$source_folder"/*; do
# mv "$file" "$destination_folder"
# echo "Moved: $file"
# done
# ####
# #### Moving data with requirements.
# ####
sourceFolder="./yolov5/data/train/images"
destinationFolder="./complete_data/images"
for file in "$sourceFolder"/*; do
validFile=false
case "$(basename "$file")" in
*_png*|*_jpg*|*_blue*|*_yellow*|*_large_orange*|*_orange*|*_unknown*)
validFile=true
;;
esac
if [ "$validFile" != true ]; then
mv "$file" "$destinationFolder"
echo "Moved: $file"
fi
case "$(basename "$file")" in
*rf*)
mv "$file" "$destinationFolder"
echo "Moved: $file"
;;
esac
done
###
### MOVE CROPS ONLY
###
# sourceFolder="./datasets/data/valid/labels"
# destinationFolder="./prepare_clean_data/data/labels"
# for file in "$sourceFolder"/*; do
# validFile=false
# case "$(basename "$file")" in
# *_blue*|*_yellow*|*_large_orange*|*_orange*|*_unknown*)
# validFile=true
# ;;
# esac
# if [ "$validFile" != false ]; then
# mv "$file" "$destinationFolder"
# echo "Moved: $file"
# fi
# case "$(basename "$file")" in
# *rf*)
# mv "$file" "$destinationFolder"
# echo "Moved: $file"
# ;;
# esac
# done
###
### MOVE BACKGROUND IMAGES
###
# sourceFolder="./prepare_clean_data/orignal_images/images"
# destinationFolder="./prepare_clean_data/background/images"
# # Enable case-insensitive matching
# shopt -s nocaseglob
# for file in "$sourceFolder"/*; do
# if [[ "$(basename "$file")" =~ background ]]; then
# mv "$file" "$destinationFolder"
# echo "Moved: $file"
# fi
# done
# # Disable case-insensitive matching (optional)
# shopt -u nocaseglob