22 lines
580 B
Bash
22 lines
580 B
Bash
#!/bin/bash
|
|
|
|
# Define the log directory path
|
|
LOG_DIR="./resources/logs/"
|
|
|
|
# Check if the directory exists
|
|
if [ -d "$LOG_DIR" ]; then
|
|
# If it exists, check if there are any .log files in it
|
|
if ls "$LOG_DIR"*.log 1> /dev/null 2>&1; then
|
|
# If there are log files, remove them
|
|
rm "$LOG_DIR"*.log
|
|
echo "Log files removed from $LOG_DIR."
|
|
else
|
|
# If no log files are found
|
|
echo "No log files found in $LOG_DIR."
|
|
fi
|
|
else
|
|
# If the directory does not exist, create it
|
|
mkdir "$LOG_DIR"
|
|
echo "Directory $LOG_DIR created."
|
|
fi
|