Удалите все файлы в рабочем проекте, но не удаляйте рабочий каталог, используйте интерактивный параметр с -r (для этого нужно выполнить руководство по команде rm)
Чтобы сохранить структуру каталогов, но удалите только обычные файлы. find /tmp/work -type f -delete
Чтобы интерактивно удалить обе каталоги и файлы, запустите. rm /tmp/work/* -irv Флаг «i» заставит rm запрашивать разрешение для каждого удаления. Флаг 'r' будет указывать rm для рекурсивного удаления файлов. Флаг 'v' заставляет rm сообщать вам, что он делает.
# use brace expansion to create three levels of directories. The -p flag tells mkdir to create parent directories as needed.
mkdir -p /tmp/work/dir_{A..D}/dir_{a,b}
# tree will show the directory structure.
tree /tmp/work
/tmp/work
├── dir_A
│ ├── dir_a
│ └── dir_b
├── dir_B
│ ├── dir_a
│ └── dir_b
├── dir_C
│ ├── dir_a
│ └── dir_b
└── dir_D
├── dir_a
└── dir_b
# For testing create empty files in each dir_a
touch /tmp/work/dir_{A..D}/dir_a/test.txt
# to Find what files will be deleted
find /tmp/work -type f
/tmp/work/dir_B/dir_a/test.txt
/tmp/work/dir_D/dir_a/test.txt
/tmp/work/dir_C/dir_a/test.txt
/tmp/work/dir_A/dir_a/test.txt
# if the correct files were found now run the command but include the delete flag
find /tmp/work -type f -delete
# if however you would prefer to remove both files and the directories interactively. The 'i' flag will make rm ask for permission for each removal. The 'r' flag will tell rm to recursively remove files. The 'v' flag makes rm tell you what it is doing.
rm /tmp/work/* -irv
Чтобы сохранить структуру каталогов, но удалите только обычные файлы. find /tmp/work -type f -delete
Чтобы интерактивно удалить обе каталоги и файлы, запустите. rm /tmp/work/* -irv Флаг «i» заставит rm запрашивать разрешение для каждого удаления. Флаг 'r' будет указывать rm для рекурсивного удаления файлов. Флаг 'v' заставляет rm сообщать вам, что он делает.
# use brace expansion to create three levels of directories. The -p flag tells mkdir to create parent directories as needed.
mkdir -p /tmp/work/dir_{A..D}/dir_{a,b}
# tree will show the directory structure.
tree /tmp/work
/tmp/work
├── dir_A
│ ├── dir_a
│ └── dir_b
├── dir_B
│ ├── dir_a
│ └── dir_b
├── dir_C
│ ├── dir_a
│ └── dir_b
└── dir_D
├── dir_a
└── dir_b
# For testing create empty files in each dir_a
touch /tmp/work/dir_{A..D}/dir_a/test.txt
# to Find what files will be deleted
find /tmp/work -type f
/tmp/work/dir_B/dir_a/test.txt
/tmp/work/dir_D/dir_a/test.txt
/tmp/work/dir_C/dir_a/test.txt
/tmp/work/dir_A/dir_a/test.txt
# if the correct files were found now run the command but include the delete flag
find /tmp/work -type f -delete
# if however you would prefer to remove both files and the directories interactively. The 'i' flag will make rm ask for permission for each removal. The 'r' flag will tell rm to recursively remove files. The 'v' flag makes rm tell you what it is doing.
rm /tmp/work/* -irv