Christian Heimes wrote:
>William Purcell wrote:
>>Hi all, I am wanting to check to see the last time a file was edited. For example, I have a directory containing two text files, file1.txt and file2.txt. I want to be able to process these files but only if they have been edited since the last time they were processed. I think that I want to be able to check the time stamp of each file. Can anyone tell me how to do that or point me in a better direction of checking the last time a file was edited?
> >>import os stat = os.stat("/etc/passwd") print stat
(33188, 362259, 2053L, 1, 0, 0, 1690, 1218550501, 1218118498, 1218118498)
> >>dir(stat)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__str__', 'n_fields', 'n_sequence_fields', 'n_unnamed_fields', 'st_atime', 'st_blksize', 'st_blocks', 'st_ctime', 'st_dev', 'st_gid', 'st_ino', 'st_mode', 'st_mtime', 'st_nlink', 'st_rdev', 'st_size', 'st_uid']
> >>stat.st_mtime
1218118498.0
use these shortcuts, IMHO they are easier than os.stat.
os.path.getmtime() - get modified time
os.path.atime() - get last accessed time (careful some admins turn
this
off on their servers for performance reasons)
os.path.ctime() - get creation time
-Larry
Is it possible to change the time stamp of a file (Win2K platform)? If
yes, how? 0 1200 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: The Biscuit Eater |
last post by:
Greetings from a second day newbie to php.
I think I have figured out a way to explode a field in a csv file (like
11-08-03) and implode it as 031108 and then compare it to the current
date(ymd)...
|
by: Abhijit Bhadra |
last post by:
Hi ,
In C++ , I have some files as per their date of creation .
The files are in the form of
maple01012005.log
maple01142005.log
maple01202005.log
sample01182005.log
|
by: Christopher |
last post by:
Hi all,
Sorry if this is a silly question but I've been having a heck of a hard
time with it and hope somebody here can lend me a hand.
I have a site with a news pages and I'd like the...
|
by: Mike Charney |
last post by:
Is there a way to check a files date and time stamp from VBA in access.
I have a need check a date stamp on a file that I am importing.
Thanks in advance,
Mike
m charney at dunlap hospital...
|
by: pob |
last post by:
I currently have a procedure that loops thru a recordset to determine
what files need to be loaded to my database. The naming convention of
the files has always been accounts.txt, namelist.txt,...
|
by: mantrid |
last post by:
Hello
Can anyone point me in the right direction for the way to read a text file a
line at a time and separate the fields on that line and use them as data in
an INSERT to add a record to a mysql...
|
by: SilentThunderer |
last post by:
Hey folks,
Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
|
by: Edwin.Madari |
last post by:
os.paht.gmtime(path) returns the last modification of path.
check out http://docs.python.org/lib/module-os.path.html
regards
Edwin
-----Original Message-----
From:...
|
by: Rob Weir |
last post by:
On 13 Aug 2008, Virgil Stokes wrote:
os.utime, http://docs.python.org/lib/os-file-dir.html.
--
-rob
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |