File Management Python scripts - Top 4 Download

File Management Python script downloads

Simple md5 sum utility

This script is a simple md5 hash utility for generating md5 checksums of files. <hash utilThis mainly useful for systems without an included "md5sum" utility, like OS-X and Win32. It shows just how useful the batteries included philosophy of Python can be, since it leverages the md5 module ...
Python

Watching a directory tree on Unix

This script continuously monitors the paths and their subdirectories for changes. If any files or directories are modified, the callable 'func' is called with a list of the modified paths of both files and directories.'func' can return a Boolean value for rescanning; if it returns True, the directory tree will be ...
Python

Where file search utility

This utility searches all the paths in a semi-colon delimited environment variable list for files matching a given filespec. By default, PATH is used for the enviroment. For example, on my >computerC:where note*.exeC:WINNTsystem32otepad.exeC:WINNTNOTEPAD.EXEThis is useful for finding which executable file will be loaded by default. The optional Environment variable is handy ...
Python

Tree

The following program displays the directory structure of a specified path using ASCII characters. The program can optionally display files in addition to directories.This program functions similar to the windows 'tree' command. ...
Python

ooo cvs

This script is a wrapper for CVS that allows versioning the content of OpenOffice.org documents. It does not store the original archive in CVS, but it extracts the content into a subdirectory on check-in and commits only those files. That makes it possible for CVS to track the actual changes instead ...
Python

Clean up a directory tree

This script can be used to clean up a directory tree irrespective of whether the directory tree contains non-empty directories. As long as the user has permission to remove the files, this will work.There is no files, thor cleaning a non-empty directory tree in python os module. os.removedirs() cannot be used to ...
Python

Extracting tar gz files in Windows

This script is meant to be used as a commmand line *.tar.gz file extractor. If it fails, then a usage note is given. It may be small, but it can be very useful for some people. Theuseful fofor which this program was written is that Windows does not come with a *.tar.gz ...
Python

Backup your files

Backup your files script makes backup versions for your files.It can be used for non-python source code also. ...
Python

Copying and Pasting Directories and Files

This script presents a few basic fuctions that allow someone to copy a directory (along with its files and sub-directories) and paste it somewhere else. They ignore links and anything else that is not a directory or a file. The data returned from copy_dir() is in a format that paste_dir() can understand. A ...
Python

RoadRunner

This recipe allows you to update desired files in a directory tree. It needs to be run from the shell. Once you run it, it will ask you for: a) the "string" you want to insert in the file b) the extension of the files to update e.g: .html c) a ...
Python

Resuming download of a file

This script shows how to resume downloading of a file that has been partially downloaded from a web server. It's been tested with Apache 1.3.x, but should work with any web server that understands the "range" header.This script uses the extra header - "Range" to let the web server know that ...
Python

Swap one file extension

This script will swap extensions on all files in the specified directory, and all of its subdirectories, and all of their subdirectories, etc. This is useful for changing the extensions of a whole batch of files in a folder structure, e.g. a web site. You can also use it for correcting ...
Python

Downloading a File from the Web

This script reads the contents of a web file and copies them into a local file, named the same as the web file. ...
Python

Cache file contents to speed access

This class caches the contents of a set of files and avoids reading files repeatedly from disk by holding onto the contents of each file as a list of strings.Some tasks require reading from a set of files in a random manner. Opening and reading files is a time consuming operation ...
Python

Extracting Windows file versions

This is my attempt at extracting the file version information from .dll, .exe, .ocx files etc. on Windows 2000 (should work with others, but I haven't tested it), without resorting to using extensions (i.e. dll functions). Put the code in a file in your PYTHONPATH (such as 'verchecker.py') and say 'from verchecker ...
Python

catenateFilesFactory

catenateFilesFactory script generates a catenateFiles function parameterized for common variations.Catenating (or concatenating) files is a common data processing task, but there are at least three independent binary choices for the functional requirements. This could mean 8 different functions, or one functions with three additional boolean arguments.Binary files are relatively easy to handle. So ...
Python

Zip and Pickle

This module saves and reloads compressed representations of generic Python objects to and from the disk. ...
Python

File Subclass

If the 'file' object looks for a '.filename.pkl' file which contains the seek offset of the previous end of the file, then this subclass sets the seek offset to that number before returning the file.On closing the file or StopIteration, it writes the new max offset to this pickle file. ...
Python

Rename subdirectories of a directory tree

I needed to write a sed/awk Python equivalent for walking into a directory tree and renaming certain subdirectories, while also looking into all xml files on the way and replacing/modifying certain strings in those files.It would be nicer if someone could suggest an enhanced re.sub(regex, replacement, subject) where I could replace ...
Python

Simple File Splitter Combiner module

This module can be used to split any file, text or binary to equal sized chunks. It can also combine the chunks back to recreate the original file.<s. It canOften we need to split big files into many chunks either for saving them to disks, uploading to a web-site or for ...
Python