Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Every computer user does some system administration, even if it’s only maintaining a stable and working system. System administration encompasses everything from keeping a computer operating to maintaining large networks with many computers and servers. Although these are radically different situations, they share some needs and techniques in common. We start our look at administration with an example of simple scripting.
For simple tasks, one of Python’s great advantages is that it doesn’t push any particular programming paradigm. If you want to write a script to automate a regular task, you aren’t forced to write an object-oriented application; you aren’t even forced to write functions if the task at hand doesn’t call for them. Listing 10.1 is a script for a typical admin task of clearing out the temp folder of files that haven’t been modified for more than seven days.