-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclean.sh
More file actions
executable file
·36 lines (28 loc) · 990 Bytes
/
clean.sh
File metadata and controls
executable file
·36 lines (28 loc) · 990 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
#!/bin/bash
# Script to remove files with extensions .log .dvi .gz .aux .out from EPP subdirectories
# Usage: ./clean.sh
# Check if EPP directory exists
if [ ! -d "EPP" ]; then
echo "Error: EPP directory not found in current location"
echo "Current directory: $(pwd)"
exit 1
fi
echo "Cleaning files from EPP subdirectories..."
echo "Removing files with extensions: .log .dvi .gz .aux .out"
echo
# Initialize counter for removed files
removed_count=0
# Extensions to remove
extensions=("*.log" "*.dvi" "*.gz" "*.aux" "*.out")
# Traverse EPP directory and remove files with specified extensions
for ext in "${extensions[@]}"; do
echo "Looking for $ext files..."
# Find and remove files with current extension
while IFS= read -r -d '' file; do
echo "Removing: $file"
rm "$file"
((removed_count++))
done < <(find EPP -type f -name "$ext" -print0 2>/dev/null)
done
echo
echo "Cleanup complete! Removed $removed_count files total."