Copying latest version of the file

Kali K E kalike2003 at netscape.net
Fri Sep 12 10:54:58 EDT 2003


Hi,
I am new to Python and excuse me if this problem is very trivial. The
problem is like this.
There is a directory (dirA) that contains files like
mypacakge-2.2.5-15.rpm, mypacakge-2.2.5-90.rpm,
anotherpackage-3.4.25.rpm etc.. As can be seen, some of the files are
new versions of same rpm (mypacakge-2.2.5-15.rpm,
mypacakge-2.2.5-90.rpm in this example). It is also true that their
timestamps are different. The program has to check for latest version
of each package and copy them to another directory (dirB). That means
in this case, it has to copy mypacakge-2.2.90.rpm to another
directory.
The directory dirA would be containing more than 500 files. Out of
these many, about 100 files may be having new version.
Another point is the number of files of same package is NOT limited to
2. So we may have mypacakge-2.2.5-15.rpm, mypacakge-2.2.5-90.rpm,
mypacakge-2.2.5-100.rpm, mypacakge-2.2.5-227.rpm in dirA and only
mypacakge-2.2.5-227.rpm has to be copied to dirB.
The same thing has to be repeated in other directories at the same
level as dirA.
Please let me know how to do this.
Thanks,
Kali




More information about the Python-list mailing list