find with -delete option on absolute paths
Julian H. Stacey
jhs at berklix.com
Thu Mar 12 18:47:53 UTC 2015
Matt Tagg wrote:
> Hey BSD folks
>
> I believe this was discussed previously (2013), though I could not
> find a resolution.
>
> To recap, suppose we try deleting files on an absolute path:
>
> matt at mtbook:/% find /tmp/foo/* -delete
> find: -delete: /tmp/foo/bar.txt: relative path potentially not safe
>
> As you can see it gives an error and quits. However if we instead try this:
>
> matt at mtbook:/% gfind /tmp/foo/* -delete
>
> GNU Find throws no error and works as expected ('bar.txt is deleted')
>
> So as an end user, I find this rather confusing. How can I get the
> same behavior with BSD Find out of the box?
Off on a tangent:
Last millenia (1987 :-) when I was using find & needed an rm to reduce
near duplicate trees on DOS & Unix, I wrote my own C
http://berklix.com/~jhs/src/bsd/jhs/bin/public/cmpd/
I've never since worried about getting syntax of test conditions
wrong & deleting good stuff by mistake.
Cheers,
Julian
--
Julian Stacey, BSD Linux Unix C Sys Eng Consultant Munich http://berklix.com
Indent previous with "> ". Reply Below as a play script.
Send plain text, Not quoted-printable, HTML, or base64.
More information about the freebsd-hackers
mailing list