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 11:14:11PM +0000, Steven M. Bellovin wrote:
>On Wed, 20 Feb 2008 00:33:18 +0200
>Aleksey Cheusov <> wrote:
>> > 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"
>Better yet, 
>       args stat -f "%N %u %g %Mp%Lp" <file_list.txt
>if all of the names are in one file.
>One thing to be wary of: files with special characters in their names.
>If you're generating the list via find, use -printx instead of -print.

that's nice, I've used -print0 before, (and the xargs -0
switch) but never noticed the -printx primary.

actually in my shell code the restore case was missing
quotes around the filename. This whole project is to
bootstrap an offisite (rsync) backup where there is most
of the files already but the uid/gid/mode are incorrect,
so if I miss setting a few files, that's okay, just need to
make most of them fixed to save bandwidth/time.

// George

George Georgalis, information system scientist <IXOYE><

Home | Main Index | Thread Index | Old Index