[Tutor] search the folder for the 2 files and extract out only the version numbers 1.0 and 2.0.
MARCUS NG
markersng at gmail.com
Mon Nov 16 23:24:08 CET 2009
Hi all,
I am really new to python and I am trying to create a script that looks at
file versions of a particular file
I have 4 files in a folder. One called myTest1.0.zip, myTest2.0.zip,
test3.txt and test4.zip in a directory/folder called allFiles on my desktop.
so the file structure is as such
C:\Users\blueman\Desktop\allFiles\myTest1.0.zip
and
C:\Users\blueman\Desktop\allFiles\myTest2.0.zip
Aim:
what is the best way to look into the allFiles directory, and only search
the folder for the 2 files myTest1.0.zip and myTest2.0.zip to extract out
only the version numbers 1.0 and 2.0.
what i have for my script so far is
############################
import os
#path of scripts folder
path="C:/Users/blueman/Desktop/allFiles/"
dirList=os.listdir(path)
for fname in dirList:
print fname
############################
so I did think of listing the file names in an array only to realise that I
wouldn't know which index to query if this script is going to be automated.
what is the best way to obtain the version numbers of the 2 files?
thank you for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091116/048c7f47/attachment.htm>
More information about the Tutor
mailing list