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).
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?
2) If you use the shell to expand the list, won't you fall into the old
"10 sorts before 2" problem?
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?
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.
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).
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,-a-a touch name*.pdf-a-a 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:
-a for f in *
-a do
-a-a-a touch $f ; sleep .1
-a done
If heterogeneous number widths are an issue (and there are
no screwy things like control characters in filenames,
and you have GNU ls):
-a ls --sort=version | while read f
-a do
-a-a-a touch $f ; sleep .1
-a done
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.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 54:18:23 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,563 |