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

Re: GNU find: "print0" and "-type" arguments



Am Donnerstag, 2. August 2012 schrieb Bob Proulx:
> > I see (on a terminal screen that does not display null characters):
> > ../dir./file
> 
> You have the order of arguments backwards.  You wanted to say this:
> 
>   find -type d -print
> 
> That would do the right thing.  Doing it the other way around doesn't
> make any sense.

I think doing it the other way around will just use -print0 on everything 
since no criteria yet specified and then apply the filter and then 
probably do nothing as an action has already been specified (hence no 
implicite -print at the end).

Well more so, find seems to stop at the first action:

martin@merkaba:~/Zeit> mkdir find-Test
martin@merkaba:~/Zeit> cd find-Test 
martin@merkaba:~/Zeit/find-Test> ls
martin@merkaba:~/Zeit/find-Test> mkdir dir
martin@merkaba:~/Zeit/find-Test> touch file
martin@merkaba:~/Zeit/find-Test> touch anotherfile
martin@merkaba:~/Zeit/find-Test> find -type d -print -name "file" -printf 
"%s %p" -name "anotherfile" -print0
.
./dir

;)

-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7


Reply to: