shell > rm -fr $(find . ~~~) 와 find . ~~~ -exec rm -fr {} \; 의 결과가 다릅니다..
글쓴이: APRIL1024 / 작성시간: 월, 2009/08/31 - 2:00오전
.svn 디렉토리를 지우려고 아래와 같이 find의 -exec로 rm를 실행하면 뭔가 이상합니다. 그냥 rm `find . ~~~` 로 하면 에러 메세지가 나오지 않네요. 결과 첨부합니다. 왜 이런지 궁금하네요..
지울 대상은 .svn 디렉토리 4개 입니다.
[shell]$ find tmp -type d -path "*/.svn" tmp/lab/sed/.svn tmp/lab/awk/.svn tmp/lab/perl/.svn tmp/lab/.svn
지우고 find가 위 결과 리스트를 주는것 같은데.. 이상하네요.
[shell]$ find tmp -type d -path "*/.svn" -exec rm -fvr {} \; removed `tmp/lab/sed/.svn/prop-base/byState.sh.svn-base' removed directory: `tmp/lab/sed/.svn/prop-base' removed directory: `tmp/lab/sed/.svn/tmp/prop-base' removed directory: `tmp/lab/sed/.svn/tmp/text-base' removed directory: `tmp/lab/sed/.svn/tmp/props' removed directory: `tmp/lab/sed/.svn/tmp' removed `tmp/lab/sed/.svn/text-base/mail.svn-base' removed `tmp/lab/sed/.svn/text-base/list.1.svn-base' removed `tmp/lab/sed/.svn/text-base/list.svn-base' removed `tmp/lab/sed/.svn/text-base/nameStateW.svn-base' removed `tmp/lab/sed/.svn/text-base/test.svn-base' removed `tmp/lab/sed/.svn/text-base/sampleLIne.svn-base' removed `tmp/lab/sed/.svn/text-base/sed.debug.svn-base' removed `tmp/lab/sed/.svn/text-base/byState.sh.svn-base' removed `tmp/lab/sed/.svn/text-base/mail.1.svn-base' removed `tmp/lab/sed/.svn/text-base/nameState.svn-base' removed `tmp/lab/sed/.svn/text-base/big.svn-base' removed directory: `tmp/lab/sed/.svn/text-base' removed `tmp/lab/sed/.svn/entries' removed `tmp/lab/sed/.svn/all-wcprops' removed directory: `tmp/lab/sed/.svn/props' removed directory: `tmp/lab/sed/.svn' <span>find: tmp/lab/sed/.svn: 그런 파일이나 디렉토리가 없음</span> removed directory: `tmp/lab/awk/.svn/prop-base' removed directory: `tmp/lab/awk/.svn/tmp/prop-base' removed directory: `tmp/lab/awk/.svn/tmp/text-base' removed directory: `tmp/lab/awk/.svn/tmp/props' removed directory: `tmp/lab/awk/.svn/tmp' removed directory: `tmp/lab/awk/.svn/text-base' removed `tmp/lab/awk/.svn/entries' removed `tmp/lab/awk/.svn/all-wcprops' removed directory: `tmp/lab/awk/.svn/props' removed directory: `tmp/lab/awk/.svn' <span>find: tmp/lab/awk/.svn: 그런 파일이나 디렉토리가 없음</span> removed directory: `tmp/lab/perl/.svn/prop-base' removed directory: `tmp/lab/perl/.svn/tmp/prop-base' removed directory: `tmp/lab/perl/.svn/tmp/text-base' removed directory: `tmp/lab/perl/.svn/tmp/props' removed directory: `tmp/lab/perl/.svn/tmp' removed directory: `tmp/lab/perl/.svn/text-base' removed `tmp/lab/perl/.svn/entries' removed `tmp/lab/perl/.svn/all-wcprops' removed directory: `tmp/lab/perl/.svn/props' removed directory: `tmp/lab/perl/.svn' <span>find: tmp/lab/perl/.svn: 그런 파일이나 디렉토리가 없음</span> removed directory: `tmp/lab/.svn/prop-base' removed directory: `tmp/lab/.svn/tmp/prop-base' removed directory: `tmp/lab/.svn/tmp/text-base' removed directory: `tmp/lab/.svn/tmp/props' removed directory: `tmp/lab/.svn/tmp' removed directory: `tmp/lab/.svn/text-base' removed `tmp/lab/.svn/entries' removed `tmp/lab/.svn/all-wcprops' removed directory: `tmp/lab/.svn/props' removed directory: `tmp/lab/.svn' <span>find: tmp/lab/.svn: 그런 파일이나 디렉토리가 없음</span>
아래와 같이 하면 에러 메세지가 없습니다.
[shell]$ rm -fvr `find tmp -type d -path "*/.svn"` removed `tmp/lab/sed/.svn/prop-base/byState.sh.svn-base' removed directory: `tmp/lab/sed/.svn/prop-base' removed directory: `tmp/lab/sed/.svn/tmp/prop-base' removed directory: `tmp/lab/sed/.svn/tmp/text-base' removed directory: `tmp/lab/sed/.svn/tmp/props' removed directory: `tmp/lab/sed/.svn/tmp' removed `tmp/lab/sed/.svn/text-base/mail.svn-base' removed `tmp/lab/sed/.svn/text-base/list.1.svn-base' removed `tmp/lab/sed/.svn/text-base/list.svn-base' removed `tmp/lab/sed/.svn/text-base/nameStateW.svn-base' removed `tmp/lab/sed/.svn/text-base/test.svn-base' removed `tmp/lab/sed/.svn/text-base/sampleLIne.svn-base' removed `tmp/lab/sed/.svn/text-base/sed.debug.svn-base' removed `tmp/lab/sed/.svn/text-base/byState.sh.svn-base' removed `tmp/lab/sed/.svn/text-base/mail.1.svn-base' removed `tmp/lab/sed/.svn/text-base/nameState.svn-base' removed `tmp/lab/sed/.svn/text-base/big.svn-base' removed directory: `tmp/lab/sed/.svn/text-base' removed `tmp/lab/sed/.svn/entries' removed `tmp/lab/sed/.svn/all-wcprops' removed directory: `tmp/lab/sed/.svn/props' removed directory: `tmp/lab/sed/.svn' removed directory: `tmp/lab/awk/.svn/prop-base' removed directory: `tmp/lab/awk/.svn/tmp/prop-base' removed directory: `tmp/lab/awk/.svn/tmp/text-base' removed directory: `tmp/lab/awk/.svn/tmp/props' removed directory: `tmp/lab/awk/.svn/tmp' removed directory: `tmp/lab/awk/.svn/text-base' removed `tmp/lab/awk/.svn/entries' removed `tmp/lab/awk/.svn/all-wcprops' removed directory: `tmp/lab/awk/.svn/props' removed directory: `tmp/lab/awk/.svn' removed directory: `tmp/lab/perl/.svn/prop-base' removed directory: `tmp/lab/perl/.svn/tmp/prop-base' removed directory: `tmp/lab/perl/.svn/tmp/text-base' removed directory: `tmp/lab/perl/.svn/tmp/props' removed directory: `tmp/lab/perl/.svn/tmp' removed directory: `tmp/lab/perl/.svn/text-base' removed `tmp/lab/perl/.svn/entries' removed `tmp/lab/perl/.svn/all-wcprops' removed directory: `tmp/lab/perl/.svn/props' removed directory: `tmp/lab/perl/.svn' removed directory: `tmp/lab/.svn/prop-base' removed directory: `tmp/lab/.svn/tmp/prop-base' removed directory: `tmp/lab/.svn/tmp/text-base' removed directory: `tmp/lab/.svn/tmp/props' removed directory: `tmp/lab/.svn/tmp' removed directory: `tmp/lab/.svn/text-base' removed `tmp/lab/.svn/entries' removed `tmp/lab/.svn/all-wcprops' removed directory: `tmp/lab/.svn/props' removed directory: `tmp/lab/.svn'
Forums:
간혹 다른 방식으로
간혹 다른 방식으로 문제를 보다보면, svn checkout 보다 svn export를 사용해야하는 경우가 있긴 합니다만. (svn:extern 속성을 사용하지 않았다면요)
find 결과를 가지고 rm하는 것과 find 중간중간 rm하는 것의 차이입니다. 예상했던 디렉토리가 이전 결과에 의해 없어져서 나오는 오류입니다.
---
coolengineer.com
---
http://coolengineer.com
이해가 되지 않습니다.
.svn 디렉토리는 아래와 같이 4개인데
1. tmp/lab/sed/.svn
2. tmp/lab/awk/.svn
3. tmp/lab/perl/.svn
4. tmp/lab/.svn
find -exec 에서 1번 찾구 바로 -exec로 넘어가는것이 아닌가요? (flow를 모릅니다..)
그렇다면 find로 찾으면서 지우나, find로 찾은 결과를 지우나 같을것 같은데요...
명쾌한 대답 기대해도 되나요? ^^;
음..
볼드체로 표시된 메시지 바로 직전에 해당 directory 가 삭제되었다는 메시지가 있습니다.
현재 탐색중인 디렉토리가 삭제되었으니, 그 디렉토리 내에서의 탐색은 더 이상 불가하게 됩니다.
그래서 해당 디렉토리가 없다는 메시지를 찍고, 다음 디렉토리 탐색으로 넘어간 겁니다.
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
댓글 달기