|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I have a problem to develop a script that sort files by access time. I've tried the command ls -ltu or stat -c "%x %n" *, but the problem is that when i'm launching the script, the date of last access is update with the time of the script. Do you have an idea for this problem ? Thanks a lot. whizzzz |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
yannick.dhennin@gmail.com wrote:
> Hi, > > I have a problem to develop a script that sort files by access time. > > I've tried the command ls -ltu or stat -c "%x %n" *, but the problem is > that when i'm launching the script, the date of last access is update > with the time of the script. > > Do you have an idea for this problem ? > ?? The atime does not change by an ls or stat command. ls -1tu should work ok. -- Michael Tosch @ hp : com |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
2006-11-09, 10:13(+01), Michael Tosch:
> yannick.dhennin@gmail.com wrote: >> Hi, >> >> I have a problem to develop a script that sort files by access time. >> >> I've tried the command ls -ltu or stat -c "%x %n" *, but the problem is >> that when i'm launching the script, the date of last access is update >> with the time of the script. >> >> Do you have an idea for this problem ? >> > > ?? > The atime does not change by an ls or stat command. > ls -1tu > should work ok. [...] Maybe the OP did a ls -ltu * in which case the atime of the directories where updated as their content was read. ls -ltu or ls -ltud -- * should not have the problem. -- Stéphane |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Hi,
thanks for your answers. the problem is when I'm doing ls -ltu or stat command the access time is modified at the time the command is done. Is it possible to have access to tha access time information of a file without modify it ? Thanks a lot, Yannick. Stephane CHAZELAS a écrit : > 2006-11-09, 10:13(+01), Michael Tosch: > > yannick.dhennin@gmail.com wrote: > >> Hi, > >> > >> I have a problem to develop a script that sort files by access time. > >> > >> I've tried the command ls -ltu or stat -c "%x %n" *, but the problem is > >> that when i'm launching the script, the date of last access is update > >> with the time of the script. > >> > >> Do you have an idea for this problem ? > >> > > > > ?? > > The atime does not change by an ls or stat command. > > ls -1tu > > should work ok. > [...] > > Maybe the OP did a > > ls -ltu * > > in which case the atime of the directories where updated as > their content was read. > > ls -ltu > > or > > ls -ltud -- * > > should not have the problem. > > -- > Stéphane |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
yannick.dhennin@gmail.com wrote:
> Hi, > > thanks for your answers. > > the problem is when I'm doing ls -ltu or stat command the access time > is modified at the time the command is done. > > Is it possible to have access to tha access time information of a file > without modify it ? As has been said, if you compare ordinary files: "The atime does not change by an ls or stat command." If in your case that's different you have to provide more information about your environment, and show what you've exactly done and what exactly the results have been. And, BTW, don't top-post. Janis > > Thanks a lot, > > Yannick. > > Stephane CHAZELAS a écrit : > > > 2006-11-09, 10:13(+01), Michael Tosch: > > > yannick.dhennin@gmail.com wrote: > > >> Hi, > > >> > > >> I have a problem to develop a script that sort files by access time. > > >> > > >> I've tried the command ls -ltu or stat -c "%x %n" *, but the problemis > > >> that when i'm launching the script, the date of last access is update > > >> with the time of the script. > > >> > > >> Do you have an idea for this problem ? > > >> > > > > > > ?? > > > The atime does not change by an ls or stat command. > > > ls -1tu > > > should work ok. > > [...] > > > > Maybe the OP did a > > > > ls -ltu * > > > > in which case the atime of the directories where updated as > > their content was read. > > > > ls -ltu > > > > or > > > > ls -ltud -- * > > > > should not have the problem. > > > > -- > > Stéphane |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
In article <1163087221.491720.98960@m73g2000cwd.googlegroups. com>,
"Janis" <janis_papanagnou@hotmail.com> wrote: > yannick.dhennin@gmail.com wrote: > > Hi, > > > > thanks for your answers. > > > > the problem is when I'm doing ls -ltu or stat command the access time > > is modified at the time the command is done. > > > > Is it possible to have access to tha access time information of a file > > without modify it ? > > As has been said, if you compare ordinary files: > "The atime does not change by an ls or stat command." > > If in your case that's different you have to provide more information > about your environment, and show what you've exactly done and what > exactly the results have been. When I saw his first post, my thought was that one of the files he's listing is the script itself. Executing the script will indeed update the atime of the script -- the shell has to read the script to execute it. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Barry Margolin a écrit : > In article <1163087221.491720.98960@m73g2000cwd.googlegroups. com>, > "Janis" <janis_papanagnou@hotmail.com> wrote: > > > yannick.dhennin@gmail.com wrote: > > > Hi, > > > > > > thanks for your answers. > > > > > > the problem is when I'm doing ls -ltu or stat command the access time > > > is modified at the time the command is done. > > > > > > Is it possible to have access to tha access time information of a file > > > without modify it ? > > > > As has been said, if you compare ordinary files: > > "The atime does not change by an ls or stat command." > > > > If in your case that's different you have to provide more information > > about your environment, and show what you've exactly done and what > > exactly the results have been. > > When I saw his first post, my thought was that one of the files he's > listing is the script itself. Executing the script will indeed update > the atime of the script -- the shell has to read the script to execute > it. > > -- > Barry Margolin, barmar@alum.mit.edu > Arlington, MA > *** PLEASE post questions in newsgroups, not directly to me *** > *** PLEASE don't copy me on replies, I'll read them in the group *** Hi, The script is done for cygwin environement. It can explain why the access-time is update. Yannick. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
yannick.dhennin@gmail.com wrote:
> Barry Margolin a écrit : > > In article <1163087221.491720.98960@m73g2000cwd.googlegroups. com>, > > "Janis" <janis_papanagnou@hotmail.com> wrote: > > > yannick.dhennin@gmail.com wrote: > > > > Hi, > > > > > > > > thanks for your answers. > > > > > > > > the problem is when I'm doing ls -ltu or stat command the access time > > > > is modified at the time the command is done. > > > > > > > > Is it possible to have access to tha access time information of a file > > > > without modify it ? > > > > > > As has been said, if you compare ordinary files: > > > "The atime does not change by an ls or stat command." > > > > > > If in your case that's different you have to provide more information > > > about your environment, and show what you've exactly done and what > > > exactly the results have been. > > > > When I saw his first post, my thought was that one of the files he's > > listing is the script itself. Executing the script will indeed update > > the atime of the script -- the shell has to read the script to execute > > it. > > > > Hi, > > The script is done for cygwin environement. It can explain why the > access-time is update. No, that doesn't, per se, explain anything. 'ls -ltu' works for me with bash on Cygwin as expected. To repeat what I said: "[...] and show what you've exactly done and what exactly the results have been." Janis > > Yannick. |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
On 10 Nov 2006 06:09:04 -0800, Janis
<janis_papanagnou@hotmail.com> wrote: > yannick.dhennin@gmail.com wrote: >> >> Hi, >> >> The script is done for cygwin environement. It can explain why the >> access-time is update. > > No, that doesn't, per se, explain anything. > 'ls -ltu' works for me with bash on Cygwin as expected. > > To repeat what I said: "[...] and show what you've exactly done and > what exactly the results have been." > It might matter which version of Windows and which filesystem (FAT or NTFS) is being used. -- A university is what a college becomes when the faculty loses interest in students. -- John Ciardi |
|
![]() |
| Outils de la discussion | |
|
|