Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22070

Re: Accessing the files by last modified time

Newsgroups comp.lang.python
Date 2012-03-23 06:00 -0700
References <26215939.1574.1332416026298.JavaMail.geo-discussion-forums@ynlt17> <mailman.882.1332416966.3037.python-list@python.org>
Subject Re: Accessing the files by last modified time
From Sangeet <mrsangeet@gmail.com>
Message-ID <mailman.920.1332507627.3037.python-list@python.org> (permalink)

Show all headers | View raw


On Thursday, 22 March 2012 17:19:23 UTC+5:30, Chris Rebert  wrote:
> On Thu, Mar 22, 2012 at 4:33 AM, Sangeet <mrsangeet@gmail.com> wrote:
> > Hi
> >
> > I am new to the python programming language.
> >
> > I've been trying to write a script that would access the last modified file in one of my directories. I'm using Win XP.
> >
> > I saw a similar topic, on the forum before, however the reply using (os.popen) didn't work out for me. I'm not sure whether it was due to syntax errors either.
> 
> Recursively or non-recursively?
> Live monitoring or just one-time?
> What was the forum post in question?
> 
> In the simple case, you just need to stitch together these functions:
> http://docs.python.org/library/os.html#os.stat
> (note the .st_mtime attribute of the result)
> http://docs.python.org/library/os.path.html#os.path.join
> with one of these functions:
> http://docs.python.org/library/os.html#os.listdir
> http://docs.python.org/library/os.html#os.walk
> 
> Cheers,
> Chris

Thanks Chris, this helped me a lot! 

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Accessing the files by last modified time Sangeet <mrsangeet@gmail.com> - 2012-03-22 04:33 -0700
  Re: Accessing the files by last modified time Chris Rebert <clp2@rebertia.com> - 2012-03-22 04:49 -0700
    Re: Accessing the files by last modified time Sangeet <mrsangeet@gmail.com> - 2012-03-23 06:00 -0700
    Re: Accessing the files by last modified time Sangeet <mrsangeet@gmail.com> - 2012-03-23 06:00 -0700
  Re: Accessing the files by last modified time Tim Williams <tjandacw@cox.net> - 2012-03-22 05:04 -0700
    Re: Accessing the files by last modified time Neil Cerutti <neilc@norwich.edu> - 2012-03-22 13:06 +0000
    Re: Accessing the files by last modified time Sangeet <mrsangeet@gmail.com> - 2012-03-23 05:59 -0700
  Re: Accessing the files by last modified time Peter Otten <__peter__@web.de> - 2012-03-22 13:38 +0100

csiph-web