[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: find question (and xargs)

On Mon, 13 May 1996, Erick Branderhorst wrote:

> find / -size +459976c -noleaf -type f -name '*.deb'|\
> xargs -n 1 dpkg-split -s {} && rm {}
> I was thinking that {} would be replaced by the filename but that's
> not the case. Anyone know how to solve this?

Two mistakes and an admonition:
You need to give -i to xargs to use the {} syntax.
You need to escape the && so that the rm will be part of the command.
For safety, you should always use -print0, -0 with find and xargs.

So do this instead:
find / -size +459976c -noleaf -type f -name '*.deb' -print0 |\
xargs -0 -n 1 -i dpkg-split -s {} \&\& rm {}


Reply to: