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

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mrsangeet@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'attribute': 0.07; 'python': 0.08; 'question?': 0.09; 'subject:Accessing': 0.09; 'subject:files': 0.09; 'to:addr:comp.lang.python': 0.09; 'am,': 0.12; '(note': 0.16; 'chris,': 0.16; 'lot!': 0.16; 'result)': 0.16; 'cc:addr:python-list': 0.16; 'syntax': 0.16; 'wrote:': 0.18; 'modified': 0.18; 'programming': 0.20; 'cheers,': 0.20; 'cc:no real name:2**0': 0.21; 'trying': 0.21; 'header:In-Reply-To:1': 0.22; 'received:209.85.220': 0.25; 'cc:addr:gmail.com': 0.28; 'language.': 0.28; "i'm": 0.28; 'script': 0.28; 'cc:addr:python.org': 0.29; '22,': 0.30; 'either.': 0.30; 'recursively': 0.30; 'chris': 0.30; "didn't": 0.30; 'url:library': 0.31; 'thu,': 0.32; "i've": 0.32; 'thanks': 0.32; 'subject:time': 0.32; 'header:User-Agent:1': 0.33; 'file': 0.34; 'url:python': 0.35; 'post': 0.36; 'cc:2**1': 0.36; 'received:google.com': 0.37; 'similar': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'subject:last': 0.38; 'url:org': 0.39; 'received:209': 0.39; 'simple': 0.61; 'march': 0.61; 'reply': 0.64; 'forum': 0.64; 'saw': 0.66; 'due': 0.66; 'topic,': 0.80; 'url:join': 0.91
Newsgroups comp.lang.python
Date Fri, 23 Mar 2012 06:00:25 -0700 (PDT)
In-Reply-To <mailman.882.1332416966.3037.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=202.131.155.21; posting-account=4XjAMQoAAAArwxavuD9MgiNlNaGtjfzF
References <26215939.1574.1332416026298.JavaMail.geo-discussion-forums@ynlt17> <mailman.882.1332416966.3037.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
MIME-Version 1.0
Subject Re: Accessing the files by last modified time
From Sangeet <mrsangeet@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org, Sangeet <mrsangeet@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.920.1332507627.3037.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1332507627 news.xs4all.nl 6850 [2001:888:2000:d::a6]:54916
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22070

Show key headers only | 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