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 05:04:52PM -0600, Ronald Roskens wrote:
>On Tue, 2008-02-19 at 23:39 +0100, Johnny Billquist wrote:
>> 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...
>
>No there won't be a problem with a large number of files. Xargs knows
>how to handle these things. It uses the sysconf _SC_ARG_MAX to set a
>maximum buffer allowed for the command + arguments. If you want to set
>it to something smaller, you can specify it on the commandline with -s
><size>.
>
># wc /usr/share/dict/words
> 234976 234976 2487217 /usr/share/dict/words
># cat /usr/share/dict/words | xargs echo | wc -l
> 47
>
>xargs split the input into 47 different commands.
Nice test!
// George
--
George Georgalis, information system scientist <IXOYE><
Home |
Main Index |
Thread Index |
Old Index