<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hi.<BR>&nbsp;&nbsp;&nbsp; I wrote a python script that goes through a specified directory and returns a list of all the files that haven't been modified since a certain date.&nbsp; I was hoping to be able to then continue with the program to bring up dos, and zip, then move the files (to my external hard drive). I have Windows XP. I don't know if it's okay to ask about Dos in&nbsp;python mailing list, so I hope it's alright.&nbsp; Here is my program, I don't know if there are any formatting rules for posting programs, so I hope this will sufice.<BR><BR>import os, sys, time<BR>def earlierThan (path, year, exclude=[]):<BR>&nbsp;&nbsp;&nbsp; all = []<BR>&nbsp;&nbsp;&nbsp; walk = <FONT face="">os.walk</FONT>(path)<BR>&nbsp;&nbsp;&nbsp; for root, dirs, files in walk:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for i in files:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (time.localtime(os.path.getmtime(root + "\\" + i))[0] &lt; year<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and doesNotHave(exclude, root)) :<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all.append(root + "\\" + i)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except OSError:&nbsp; #I think that&nbsp;I might need a more specific error message, as this one would&nbsp;handle something<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#That's not necessarily a broken file name. (I got one of them when I ran it).<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print root + "\\" + i + " was not included in the list"<BR>&nbsp;&nbsp;&nbsp; return all<BR>
<BR>def doesNotHave(exclude, root):<BR>&nbsp;&nbsp;&nbsp; for x in exclude:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if root.startswith(x) &gt; -1:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return False<BR>&nbsp;&nbsp;&nbsp; return True<BR><BR>I've had little experience with dos.&nbsp; I believe I should use the COMPACT, and then the MOVE&nbsp;dos <FONT face="">command... Would it go something like this?<BR><BR></FONT>g = earlierThan("G:\My Documents", 2007, ["Music"])<BR>for x in g:<BR>
&nbsp;&nbsp;&nbsp;&nbsp; os.system("COMPACT /F " + x)<BR>
&nbsp;&nbsp;&nbsp;&nbsp; os.sytem("MOVE " + x + " " + "H:\Backup")<BR><BR>Thanks<BR><BR><br /><hr />Need to know the score, the latest news, or you need your HotmailŪ-get your "fix". <a href='http://www.msnmobilefix.com/Default.aspx' target='_new'>Check it out.</a></body>
</html>