
run-*.achilles
Linux에서 모든 하위 디렉터리의 모든 디렉터리를 제거하려면 어떻게 해야 합니까 ?
시도했지만 find /path -name run-*.achilles -type f -delete
작동하지 않습니다.
답변1
여기에는 몇 가지 문제가 있습니다.
*
쉘 글로빙을 방지하려면 인용해야 합니다 .-type f
find
파일을 원한다고 알려줍니다 .find -delete
비어 있지 않은 디렉토리는 삭제되지 않습니다.이 질문을 참조하세요. 답변 중 하나에서 조정된 솔루션:find /path -path '*/run-*.achilles/*' -delete find /path -type d -name 'run-*.achilles' -empty -delete
완벽하지는 않습니다. 첫 번째 줄은 일치합니다 .../run-a/b.achilles/...
. 제 생각에는. 이 명령은 더 잘 일치해야 합니다.
find /path -type d -name 'run-*.achilles' -exec rm -rf {} +
을 사용하므로 rm -rf
주의하시기 바랍니다.