deleting files

Andreas Jung ajung-ml at andreas-jung.com
Mon Feb 26 08:21:46 EST 2001


you can get the modification or creation time of a file through
os.stat(). It returns a tuple of informations about the file (modification
time,creation time, file size).
By checking the creation time you can remove the file by using os.unlink().

Andreas
----- Original Message -----
From: "James Lockley" <j_lockley at hotmail.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, February 26, 2001 5:53 AM
Subject: deleting files


> hi
>
> i want to delete a file created after a particular time ( ie something
like
> if os.path.getmtime(file)>t0: <delete(file>)
> i've looked through shutil and can't find anything to use... (i don't want
> to delete tree so rmtree is of no use)
>
> thanx in advance
> james
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list