NetBSD-Users archive

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

Re: geting some file stat

Aleksey Cheusov skrev:
Thanks all for your help,

indeed stat -f "%Mp%Lp:%u:%g:%N"
does the trick

On Tue, Feb 19, 2008 at 02:26:10PM -0600, Robby Griffin wrote:
 >> Don't forget you can stat multiple files, too:
 >> stat -f "%N %u %g %Mp%Lp" filename1 filename2 ...

but I have a *large* number of files.. and would expect a shell error
using them all on one line...

cat file_list.txt | xargs stat -f "%N %u %g %Mp%Lp"

And of course that *will* be a problem if he has a large number of files, since there are limits on how long lines are acceptable...

xargs causes the same deal, and have the same limit as the shell itself. You pass a large line to the stat program.

If indeed the number of files are so large that this is a problem, then he needs to process the files fewer at a time. There are several ways to go about doing that. Putting the result in a file, and then split the file, and go through each piece independently for instance, or use find in a more creative way...


Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email:             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol

Home | Main Index | Thread Index | Old Index