Gerard Beekmans wrote:
> Bruce Dubbs wrote:
>> In the LFS cleanfs script, we have the construct:
>>
>> cd /tmp &&
>> find . -xdev -mindepth 1 ! -name lost+found \
>> -delete || failed=1
>>
>> Since I test build a lot of apps in /tmp, this instruction can take a
>> very long time upon bootup. Can we change it to make the process a bit
>> faster? How about something like:
>>
>> for file in /tmp/*; do
>> if [ $file != lost+found ]; then rm -r $file; fi
>> done
>
> One issue that comes to mind are errors "argument list too long." I
> don't know if a "for file in *" construct has this problem. It has
> happened a few times where a simple "rm dir/*" failed because there were
> more files than there is room in rm's argument list.
Perhaps, but the current command looks at every file at every depth. I
had a build of seamonkey on my /tmp directory and just did:
cd /tmp/seamonkey
time find . -xdev -mindepth 1 -delete -print
and got every file printed and
real 0m20.987s
user 0m0.457s
sys 0m2.833s
Perhaps
find . -xdev -mindepth 1 -maxdepth 1 ! -name lost+found -exec rm -rf {} \;
would work better.
-- Bruce
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page