[CentOS] Computer 1A question

Robert kerplop at sbcglobal.net
Sat Aug 5 16:06:47 UTC 2006


Joshua Baker-LePain wrote:

> On Sat, 5 Aug 2006 at 8:27am, Todd Cary wrote
>
>> Joshua Baker-LePain wrote:
>>
>>> On Sat, 5 Aug 2006 at 7:48am, Todd Cary wrote
>>>
>>>> This one worked like a champ:
>>>>
>>>> find /home/mydir -name "*.zip" -type f -exec rm {} \;
>>>>
>>>> Whereas this one produced an error:
>>>>
>>>> find /home/mydir -name "*.zip" -type f -print0 | xargs -0 rm
>>>
>>>
>>> For completeness' sake, what was the error?
>>>
>> The error is
>>
>> rm: Too few arguments
>>
>> find /home/mydir -name "*.zip" -type f -print0 | xargs -0 rm
>
>
> Odd -- that WORKSFORME.
>
WORKSFORME2 -- One time in a row.  Like this:


[rj at mavis ~]$ find /home/rj/Desktop/Trash -name "*.zip" -type f -print0 
| xargs -0 file
/home/rj/Desktop/Trash/ezphotocalendarcreatorv3.25serialcat.zip:   Zip 
archive data, at least v2.0 to extract
/home/rj/Desktop/Trash/ezphotocalendarcreatorv3-2.25serialcat.zip: Zip 
archive data, at least v2.0 to extract
/home/rj/Desktop/Trash/6664037a0e353d9311481cb6cf777cc3041.zip:    Zip 
archive data, at least v2.0 to extract
/home/rj/Desktop/Trash/ezphotocalendarcreatorv3-5.25serialcat.zip: Zip 
archive data, at least v2.0 to extract
/home/rj/Desktop/Trash/ezphotocalendarcreatorv3-4.25serialcat.zip: Zip 
archive data, at least v2.0 to extract
/home/rj/Desktop/Trash/ezphotocalendarcreatorv3-1.25serialcat.zip: Zip 
archive data, at least v2.0 to extract
/home/rj/Desktop/Trash/9864037a0e353d9311481cb6cf777cc3041.zip:    Zip 
archive data, at least v2.0 to extract

So, we have 7 files; remove 'em

[rj at mavis ~]$ find /home/rj/Desktop/Trash -name "*.zip" -type f -print0 
| xargs -0 rm

Check to see they're gone and the "file" command gets uptight

[rj at mavis ~]$ find /home/rj/Desktop/Trash -name "*.zip" -type f -print0 
| xargs -0 file
Usage: file [-bcikLnNsvz] [-f namefile] [-F separator] [-m magicfiles] 
file...
       file -C -m magicfiles
Try `file --help' for more information.

Now, try to remove the already-removed files:
[rj at mavis ~]$ find /home/rj/Desktop/Trash -name "*.zip" -type f -print0 
| xargs -0 rm
rm: too few arguments
Try `rm --help' for more information.

The error looks a tad familiar.

[rj at mavis 
~]$                                                                                               




More information about the CentOS mailing list