我正在使用 Linux 并且有一个文件夹,其中包含许多子目录。我需要删除所有具有相同名称的子目录。例如,
dir
|---subdir1
|---subdir2
| |-----subdir1
|---file
我想删除所有subdir1
. 这是我的脚本:
find dir -type d -name "subdir1" | while read directory ; do
rm -rf $directory
done
但是,我执行它但似乎没有任何反应。
我也试过了find dir -type d "subdir1" -delete
,但仍然没有任何反应。