Skip to content

Commit dce5bce

Browse files
committed
examples: improve clean script
Remove mala_vis dir. Remove code duplication. Recursively find dirs and go clean up there.
1 parent 5f51c1d commit dce5bce

1 file changed

Lines changed: 22 additions & 32 deletions

File tree

examples/clean.sh

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,26 @@
11
#!/bin/sh
22

3+
set -u
4+
35
# Remove artifact files that some example scripts write.
46

5-
cd basic
6-
rm -rvf \
7-
*.pth \
8-
*.pkl \
9-
*.db \
10-
*.pw* \
11-
__pycache__ \
12-
*.cube \
13-
ex10_vis \
14-
*.tmp \
15-
*.npy \
16-
*.json \
17-
*.zip \
18-
Be_snapshot* \
19-
lammps*.tmp
20-
cd ..
21-
cd advanced
22-
rm -rvf \
23-
*.pth \
24-
*.pkl \
25-
*.db \
26-
*.pw* \
27-
__pycache__ \
28-
*.cube \
29-
ex10_vis \
30-
*.tmp \
31-
*.npy \
32-
*.json \
33-
*.zip \
34-
Be_snapshot* \
35-
lammps*.tmp
36-
cd ..
7+
here=$(dirname $(readlink -f $0))
8+
for dir in $here $(find $here -mindepth 1 -type d | grep -vE '\.ruff_cache|__pycache__'); do
9+
cd $dir
10+
echo "cleaning: $(pwd)"
11+
rm -rvf \
12+
*.pth \
13+
*.pkl \
14+
*.pk \
15+
*.db \
16+
*.pw* \
17+
*.cube \
18+
ex10_vis \
19+
*.tmp \
20+
*.npy \
21+
*.json \
22+
*.zip \
23+
Be_snapshot* \
24+
lammps*.tmp \
25+
mala_vis
26+
done

0 commit comments

Comments
 (0)