Article View: comp.unix.shell
Article #385Re: Time-stamping files
From: Brian Patrie
Date: Sun, 15 Nov 2026 10:11
Date: Sun, 15 Nov 2026 10:11
35 lines
2617 bytes
2617 bytes
Janis Papanagnou wrote:
> Occasionally I'm downloading a series of files, be it episodes of
> films, chapters of documents, etc., and I'm numbering the files with
> a name indicating the document and containing a sequence number 1..N
> and I want them also stored with ascending file system time-stamps.
> Given that I trigger my downloads in parallel I have to 'touch' the
> files in the correct order afterwards. So far the use case.
>
> What I lazily did was, say, touch name*.pdf but while the shell's
> file expansion lists sequentially name1.pdf name2.pdf ... name8.pdf
> the 'touch' command seems to _operate_ arguments in *reverse* order.
>
> It's no biggie, but I had been wondering about that behavior. I'd at
> least have expected an option available with 'touch' to control that,
> or that the files are handled sequentially as provided as arguments.
>
> I had thus written my own 'touchlist' script/hack to "fix" that. But
> I'd be curious about thoughts concerning that behavior of 'touch' (or
> alternative approaches).
The most obvious is, of course:
for f in *
do
touch $f ; sleep .1
done
If heterogeneous number widths are an issue (and there are
no screwy things like control characters in filenames,
and you have GNU ls):
ls --sort=version | while read f
do
touch $f ; sleep .1
done
Technical Details
Message-ID:
<11dc0fr$2llji$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-mailReferences:
<11d957u$1fnqs$1@dont-email.me>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: Brian Patrie <bpatrie@bellsouth.spamisicky.net> Newsgroups: comp.unix.shell Subject: Re: Time-stamping files Date: Sun, 15 Nov 2026 04:11:05 -0600 Organization: an elaborate system of piles and accidents Lines: 35 Message-ID: <11dc0fr$2llji$1@dont-email.me> References: <11d957u$1fnqs$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 15 Nov 2026 10:11:08 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2807410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jdWiUh5PCe/HoSmikCd8h//3O2E8JX7Y="; posting-host="d7c03f9055f51752fd0d22336ba59ee4" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:fD2du6esFOIFWUHKB2TjX6XkV6g= sha256:q/xZfPOADmqmIoh/wU0Wq1VSJzPq7OmImbz4kXxWdbQ= sha1:891pEdLY4XD7MLg3bPaHNfPYa+A= sha256:HxtvMn7oHFb8pIdxR5qTk+HFOK/ZMBvNRlaEietJbvQ= Content-Language: en-US In-Reply-To: <11d957u$1fnqs$1@dont-email.me>