-
Notifications
You must be signed in to change notification settings - Fork 1
/
clear_cache.sh
executable file
·38 lines (34 loc) · 1.26 KB
/
clear_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
#!/bin/bash
PYSTRING="$(find . | grep -E "(__pycache__|\.pyc|\.pyo$)")"
IPYNBSTRING="$(find . | grep -E "(ipynb_checkpoints|\.ipynb$)")"
DBSTORESTRING="$(find . | grep -E "(DS_Store|\.DS_Store$)")"
# 删除 __pycache__ 缓存文件
if [ -n "$PYSTRING" ]; then
echo "删除以下缓存文件 :"
echo "-----------------------------------------------------"
echo "$PYSTRING"
echo "-----------------------------------------------------"
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
else
echo "不存在 __pycache__ 缓存文件"
fi
# 删除 ipynb_checkpoints 缓存文件
if [ -n "$IPYNBSTRING" ]; then
echo "删除以下缓存文件 :"
echo "-----------------------------------------------------"
echo "$IPYNBSTRING"
echo "-----------------------------------------------------"
find . | grep -E "(ipynb_checkpoints|\.ipynb$)" | xargs rm -rf
else
echo "不存在 ipynb_checkpoints 缓存文件"
fi
# 删除 DS_Store 缓存文件
if [ -n "$DBSTORESTRING" ]; then
echo "删除以下缓存文件 :"
echo "-----------------------------------------------------"
echo "$DBSTORESTRING"
echo "-----------------------------------------------------"
find . | grep -E "(DS_Store|\.DS_Store$)" | xargs rm -rf
else
echo "不存在 DS_Store 缓存文件"
fi