![]() | Ned Batchelder : Blog | Code | Text | Site makeroom.py » Home : Code : Shell Utils |
Created 11 September 2003, last updated 14 September 2005 This is a script to ensure there's a certain amount of free space on the disk. It works by deleting child directories until a target goal for free space has been reached. It is designed to run automatically on a machine that performs repetitive disk-clogging tasks, such as a nightly build machine. You run it (for example) like this: python makeroom.py -s 2.5*G c:\builds It deletes child directories of c:\builds until there's 2.5 Gig free on the disk. The child directories are deleted starting with the oldest by modification date. Directories that contain a file named "keep.txt" are never deleted. Deleting stops when the disk has enough free space. If the disk has enough free space to start with, nothing is deleted. The -s argument is the amount of free space needed, and can be any Python numeric expression, with K, M, and G available for kilobytes, megabytes and gigabytes. Download: makeroom.py | |
Comments
Add a comment: