[CentOS] The directory that I am trying to clean up is huge
Kwan Lowe
kwan.lowe at gmail.com
Tue Jan 26 21:30:50 UTC 2010
On Tue, Jan 26, 2010 at 1:15 PM, Les Mikesell <lesmikesell at gmail.com> wrote:
> On 1/26/2010 11:42 AM, James B. Byrne wrote:
>>
>> On Mon, January 25, 2010 13:40, Les Mikesell wrote:
>> .
>>>
>>> I'd say it is more likely that the command that resulted in an error
>>> wasn't exactly what was posted or there is a filesystem problem.
>>>
>>
>> I do not consider a file system issue, as in error or corruption,
>> highly probable in this case. It might be, however, that something
>> returned by the find caused rm itself to choke.
>
> Causing one instance of the per-file rm invocations to choke shouldn't
> bother the rest. And while file system corruption isn't likely, it is
> still a possible cause of generally-strange behavior. The most probable
> thing still seems like there was an unquoted * on the line that was
> actually typed when the error was reported.
To illustrate what you and others were saying I did the following:
[kwan at linbox find_test]$ cat add_one.sh
#!/bin/sh
COUNTER=`cat counter`
COUNTER=`expr ${COUNTER} + 1`
echo ${COUNTER}
echo "${COUNTER}" > counter
[kwan at linbox find_test] mkdir foo; cd foo; for i in $(seq 1 1 20);
do touch a${i}; done
[kwan at linbox find_test]$ ls
add_one.sh counter foo
[kwan at linbox find_test]$ ls foo
a1 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a2 a20 a3
a4 a5 a6 a7 a8 a9
[kwan at linbox find_test]$ echo "0">counter
[kwan at linbox find_test]$ find foo -name "a*" |xargs ./add_one.sh
1
[kwan at linbox find_test]$ echo "0">counter
[kwan at linbox find_test]$ find foo -name "a*" -exec ./add_one.sh {} \;
1
2
[snip]
18
19
20
Finally:
[kwan at linbox find_test]$ find foo -name a* -exec ./add_one.sh {} \;
[kwan at linbox find_test]$
(This last one has no results because the a* is not quoted and
therefore expanded by the shell before it hits the find command. )
More information about the CentOS
mailing list