🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #383

Re: Time-stamping files

#383
From: Janis Papanagnou
Date: Sat, 14 Nov 2026 11:10
45 lines
3268 bytes
On 2026-11-14 10:28, Kenny McCormack wrote:
> But I have 3 general comments/concerns:
> 
>      1) If you touch them on-masse, isn't there some risk that they all end
>      up with the same timestamp - even if "touch" does re-calculate the
>      current time for each file - on a sufficiently fast machine?  What is
>      the granularity of file timestamps on your system?

The granularity that 'stat' provides shows, e.g.: 13:43:00.056163913

My script uses sub-seconds to distinguish the files, so if I have 5
files they get a date/time setting of date-time.# where "#" are the
sub-seconds. The granularity depends on the number of files (I'm
evaluating "$#" and if I happen to have a list of, say, 200 files
the sub-second resolution uses three digits hh:mm:ss.###).

> 
>      2) If you use the shell to expand the list, won't you fall into the old
>      "10 sorts before 2" problem?

I'm used to number sequences of such file-sets with leading zeroes,
so I'll have with, say, 20 PDF files files name01.pdf ... name20.pdf.

> 
>      3) I'm surprised that the files aren't already time-stamped in the same
>      order in which they were downloaded.  Wouldn't that already be what you
>      want?

Yes, if they'd be strictly serialized on download. For the general
case I'm using asynchronous downloads; I start a couple downloads in
parallel and if the files are large it may happen that files with a
higher serial number will be completed first; that may happen if the
files are of different size or if one process overhauls another.

If I can script all the download then I could use the plain 'touch',
but often the sources are available through a website only, so I
trigger the downloads from a browser and cannot directly control the
arrival time.

Besides these application cases I considered it worthwhile to have a
script that just does what I want it to do; process the argument list
so that the files get sorted the same way when I'm doing a "ls -ltr".

Janis
Technical Details
Message-ID: <11d9fi9$1fnqt$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11d957u$1fnqs$1@dont-email.me> <11d99ke$1i4he$1@news.xmission.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.unix.shell
Subject: Re: Time-stamping files
Date: Sat, 14 Nov 2026 12:10:01 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <11d9fi9$1fnqt$1@dont-email.me>
References: <11d957u$1fnqs$1@dont-email.me>
 <11d99ke$1i4he$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 14 Nov 2026 11:10:02 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1564509"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+22h0yzx3j0uGle6Bi87xO"; posting-host="5da5b31f753a0b33e23e844e43ccbcd4"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:pIuWq7C4LhvsrxKNbBdfD9uf0F0= sha256:qru+Ew2Zz4iVhhF2v+nMOeNBc9YkOnWAxlQ+x/HhXwg=
	sha1:IdS16QMiI+jPWWOt0p8PdCYyc48= sha256:kofHQtPfIfwT0wOntcMCDG6BbcKl2KByB7nmoqkBZCA=
Content-Language: en-US
In-Reply-To: <11d99ke$1i4he$1@news.xmission.com>