On Tue, 19 Jul 2011 11:24:55 -0700, Grant wrote about Re: [gentoo-user]
Any way around "Argument list too long"?:

[snip]
> > The double dash will prevent mv from interpreting weird file names
> > like "-h" as parameters. Just about every standard GNU tool
> > supports this.
> 
> Does that apply to a command like this:
> 
> /usr/bin/find /home/user -type f -name "*-`/bin/date -d 'yesterday'
> +\%Y\%m\%d`*.jpg" -delete

No.

The find command is far too complicated for such a simple mechanism to
make sense.  Stopping the parser on such a character sequence has the
potential for disaster.

> Maybe it should be changed to this:
> 
> /usr/bin/find /home/user -type f -name -- "*-`/bin/date -d 'yesterday'
> +\%Y\%m\%d`*.jpg" -delete

If you wish to delete JPEG files that are a day or more old, you might
be better off using the ctime field in the directory entry:

 find /home/user -daystart -ctime 0 -type f -name \*.jpg -delete

To see which files would be deleted, run the above command with -delete
replaced by -print.

Note also that the "back-quote" notation for command sub-shells has been
deprecated since about 1993.  See:
  http://compute.cnr.berkeley.edu/cgi-bin/man-cgi?ksh+1
and scroll down to the bottom of page 11.  You are better off using the
more modern $(command ...) notation.
-- 
Regards,

Dave  [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
dwn...@ntlworld.com (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Attachment: signature.asc
Description: PGP signature

Reply via email to