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

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

On 08/01/2012 08:41 PM, Kumar Appaiah wrote:
On Wed, Aug 01, 2012 at 07:33:35PM -0500, Alex Robbins wrote:
This is the expected output.  However, when I execute:
find -print0 -type d
I see (on a terminal screen that does not display null characters):

The same goes for using "-type f".  It appears as though find
ignores the -type argument when the -print0 option is passed.  Isn't
this a bug?
No. If you refer to the man page, it will reveal that -print0 actually
outputs null characters instead of newlines. It is usually useful in
conjunction with the -0 option for xargs to run commands on each file
or directory found by find. Please read the man pages and they have
nice examples at the bottom.

Yes, I read the man page and I know what the -print0 option is
supposed to do.  Notice, however, that when I executed "find
-print0 -type d" the output (which, we both understand, is delimited
by null characters) includes the regular file, even though I specified "-type d".

Reply to: