NetBSD-Users archive

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

Re: geting some file stat

On Tue, Feb 19, 2008 at 02:58:03PM -0500, George Georgalis wrote:
>On Tue, Feb 19, 2008 at 11:32:27AM -0800, Jan Schaumann wrote:
>>George Georgalis <> wrote:
>>> I'm having difficulty determining a fast way to get the
>>> mode/UID/GID of a *large* number of files... I'm trying
>>> to use stat, but the numeric values that I could record
>>> for later input to chmod/chown commands are not easy to
>>> come by. Best method I see is to grep out stat -x output
>>> but I was wondering if there is a way to use -f or some
>>> other means?
>>stat -f "%u %g %p" filename
>Perfect. I must have been confused by all the details in
>the man page, also no "uid" or "gid" strings to search
>So, what is the most efficient way to get the 4 least
>significant bytes of "%p" (for input to chmod)?

Think I got it.. stat -f "%u %g %Mp%Lp" filename

// George

George Georgalis, information system scientist <IXOYE><

Home | Main Index | Thread Index | Old Index