Add:delete test code shell.
This commit is contained in:
parent
a45b623aff
commit
ca522ccd78
29
tools/shell/delete_test_code.sh
Executable file
29
tools/shell/delete_test_code.sh
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 检查参数
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <directory>"
|
||||||
|
echo "Example: $0 /path/to/search"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 检查目录是否存在
|
||||||
|
if [ ! -d "$1" ]; then
|
||||||
|
echo "Error: Directory '$1' does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 递归遍历并删除文件
|
||||||
|
find "$1" -type d -name "tool" | while read -r tool_dir; do
|
||||||
|
# 在tool目录下查找src目录
|
||||||
|
src_dir="$tool_dir/src"
|
||||||
|
if [ -d "$src_dir" ]; then
|
||||||
|
# 删除src目录下的所有文件
|
||||||
|
find "$src_dir" -type f -delete
|
||||||
|
echo "Deleted all files in '$src_dir'"
|
||||||
|
else
|
||||||
|
echo "No 'src' directory found in '$tool_dir'"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Operation completed."
|
Loading…
Reference in New Issue
Block a user