-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_cache.sh
49 lines (43 loc) · 1.17 KB
/
clean_cache.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
#!/bin/bash
# List of directories to clean
DIRS_TO_CLEAN=(
"./cache/diarized_transcripts"
"./cache/raw_sorted_sentence_collection"
"./cache/errant_all_evaluation"
"./cache/explained_sentences"
"./cache/rag_sentences"
)
# List of directories where all subdirectories should be removed
DIRS_TO_CLEAN_SUBDIRS=(
"./cache/diarized_audios"
)
# Function to remove all files in a specified directory
clean_files() {
local DIR=$1
if [ -d "$DIR" ]; then
echo "Cleaning files in directory: $DIR"
rm -f "$DIR"/*
echo "All files removed from: $DIR"
else
echo "Directory does not exist: $DIR"
fi
}
# Function to remove all subdirectories in a specified directory
clean_subdirectories() {
local DIR=$1
if [ -d "$DIR" ]; then
echo "Removing all subdirectories in: $DIR"
find "$DIR" -mindepth 1 -type d -exec rm -rf {} +
echo "All subdirectories removed from: $DIR"
else
echo "Directory does not exist: $DIR"
fi
}
# Clean files in specified directories
for DIR in "${DIRS_TO_CLEAN[@]}"; do
clean_files "$DIR"
done
# Clean subdirectories in specified directories
for DIR in "${DIRS_TO_CLEAN_SUBDIRS[@]}"; do
clean_subdirectories "$DIR"
done