Newbie... Help with Dates/Times
yeahoo at yeehaa.com
Mon Jul 9 06:13:02 CEST 2001
I'm an expert VB programmer by profession. I believe VB is on the way
out due to .NET, C#, python, etc. As such, I've begun a mid-life
transition away from VB. Python seems like a logical, fun place to
Here's my first py project...
- Multiple network drives to search
- Pattern match directory names (200-1000 matched per drive)
- Pattern match file names within matched dir
- Compare file dates (time is irrelevant) of matching files to a
target date determined by user.
- If filedate is >= (equal to or after) the target date, the fully
qualified path prints to a file.
Currently, I'm using an os.path.walk routine to gather the files per
Here's my problem...
Im lost on the date stuff.
1) I'm thinking of comparing seconds... os.path.getmtime('myfile').
How do I strip off the time and get the seconds based on only the
2) How do I get the seconds for the target date. The user is entering
a date. Do I create a time tuple and then convert that to seconds?
This turned out to be a rather complex first project. And I haven't
put on a GUI yet. In VB this thing took me less than 45 mins with a
GUI, and complete error trapping, including network errors! The user
even chooses which drives to search based on the available mappings.
But it's time to move on.
I'm open to any tips, comments, performance recommendations, etc
regarding this project and my transition.
More information about the Python-list