From owner-freebsd-questions@FreeBSD.ORG Tue Jan 3 20:55:48 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F50A106566C for ; Tue, 3 Jan 2012 20:55:48 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 268508FC17 for ; Tue, 3 Jan 2012 20:55:47 +0000 (UTC) Received: from pps.filterd (ltcfislmsgpa04 [127.0.0.1]) by ltcfislmsgpa04.fnfis.com (8.14.4/8.14.4) with SMTP id q03KQ6WL021189; Tue, 3 Jan 2012 14:55:34 -0600 Received: from smtp.fisglobal.com ([10.132.206.31]) by ltcfislmsgpa04.fnfis.com with ESMTP id 1248c3r686-9 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 03 Jan 2012 14:55:34 -0600 Received: from dtwin (10.14.152.15) by smtp.fisglobal.com (10.132.206.31) with Microsoft SMTP Server (TLS) id 14.1.323.3; Tue, 3 Jan 2012 14:55:08 -0600 From: Devin Teske To: "'Dan Nelson'" , "'Polytropon'" References: <20120103211150.41f1934d.freebsd@edvax.de> <20120103204902.GG24192@dan.emsphone.com> In-Reply-To: <20120103204902.GG24192@dan.emsphone.com> Date: Tue, 3 Jan 2012 12:55:12 -0800 Message-ID: <050501ccca59$fdd50d00$f97f2700$@fisglobal.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQKF7wihvmtHUd7H07gv6E/uWvp6BQH62cXDlHj+WqA= Content-Language: en-us X-Originating-IP: [10.14.152.15] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2012-01-03_03:2012-01-03, 2012-01-03, 1970-01-01 signatures=0 Cc: 'FreeBSD Questions' Subject: RE: Exact timestamp for sorting and renaming files according to creation order X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 20:55:48 -0000 > -----Original Message----- > From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd- > questions@freebsd.org] On Behalf Of Dan Nelson > Sent: Tuesday, January 03, 2012 12:49 PM > To: Polytropon > Cc: FreeBSD Questions > Subject: Re: Exact timestamp for sorting and renaming files according to creation > order > > In the last episode (Jan 03), Polytropon said: > > For a sorting script, I'm currently searching for a method to get file > > creation date and time as exactly as possible. The best resolution I > > could get was seconds. In case more than one file is created within > > the same second, it doesn't work precisely enough. It should work > > from sh script. > > > > For the purpose of preparing the sort list (that will be sorted and > > then be used as a template for renaming the files with a prefix and a > > counter), I'm using the "stat" program which creates output like this: > > > > % stat -f "%N %B" -t "%Y-%m-%d_%H:%M:%S" 1.txt > > 1.txt 2012-01-03_12:12:12 > > > > It's also possible to use the Epoch time format, but it doesn't > > provide a solution better than seconds: > > > > % stat -f "%N %B" -t "%s" 1.txt > > 1.txt 1325589132 > > If you ask for the date to be printed in "float" (F) format, it gives more precision. > The default is unsigned int (U) format. > > % stat -f "%N %FB" /COPYRIGHT > /COPYRIGHT 1306190895.046721049 And you can specify "float precision" ... % stat -f "%N %.2FB" /COPYRIGHT Will return only 2 decimal places. -- Devin > > > I've read the manuals for stat as well as for strftime (which is the > > facility stat's -t parameter addresses), but found nothing that is > > more precise than seconds. > > > > Does anyone have a suggestion how to precisely determine the order > > files have been created? > > -- > Dan Nelson > dnelson@allantgroup.com > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" _____________ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.