Hello all,
I’ve just started trying to use Python to automate
Windows system administration. I wrote my first (long-winded, amateurish)
shell-tool to os.path.walk through a directory structure and delete files older
than 2 days. (Keeps users from cluttering some temporary storage space)
Looks like you're only deleting files, with the "if not
os.path.isdir(path)" line. But beyond that, I think there's a problem
with the order in which os.path.walk will call your lister. walk() will
call lister from top-down, whereas a delete type function like this needs to
walk from botto
I only skimmed you message, but I couldn't see
os.removedirs in it:
>>> help('os.removedirs')Help on
function removedirs:
removedirs(name)
removedirs(path) -> None
Super-rmdir; remove a leaf directory and empty all
intermediate ones. Works like rmdir except that, if
the l
Adam, Richard, Microsoft seems to have changed the email standards
again; do you think you could send in plain text?
Thanks, I appreciate it.
(yes, my email client reads html, but it can't cope with this.)
> "AG" == Adam Getchell <[EMAIL PROTECTED]> writes:
AG>
AG>
AG>
AG>
AG>
AG>
Sorry about the HTML mail -- here it is plain text.
If I understand the suggestions, to do this properly I should probably
be doing a Depth-First Search. Well, interestingly I need to do just
this for another tool which constructs a dependency tree based upon file
dependencies for a particular co
Why not use Matthew's suggestion of os.removedirs() - sounds like its all
that you need. Its not as much fun, but I think that single call will do
what your entire script is intending to do.
- Rick
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Adam
G