File Management Python scripts - Top 4 Download

File Management Python script downloads

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

File Extractor

This program is meant to be used to extract *.BMP and *.JPG files from one file that has one or more of these image files stored inside of it. Corruption of the image file is verified manually after the file has been extracted.This program was designed for use with a deleted-file ...
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

File Unzip

File Unzip is a Python class to extract zip files. It's also written for easy use as a standalone script from the commandline. While there are many ways to add files to a zip archive via python, I have been unable to locate a good solution of extracting those same files ...
Python

Filetail

This script is a module that allows for reading lines from a continuously-growing file (such as a system log).It handles log files that get rotated/trucated out from under us.This is useful for writing all sorts of log-monitoring scripts. As given, it only provides a line-by-line interface (perfectly reasonable if all you're doing ...
Python

Flexible directory walking

This function walks a directory tree starting at a specified root folder, and returns a list of all of the files (and optionally folders) that match our pattern(s).The standard match our tree function os.path.walk can be confusing, and is difficult to customize. It can also be slow. Here's an alternative that ...
Python

FSlint

FSlint is a utility to find and clean various forms of lint on a filesystem. One form of lint it finds for example is duplicate files. It has both GUI and command line modes. ...
Python

Generic file processor method

Generic file processor method script helps you to manage files. Old LineReader class was thrown to /dev/null - fd will really be exhausted during each call of process(), so a simple method is enough. ...
Python

Helpful 5 liner version of os makedirs

This script contains a function that creates missing directories for a given path and returns a normalized absolute version of the path.If the given path already exists in the filesystem the filesystem is not modified.Otherwise makepath creates directories along the given path using the dirname() of the path. You may append a ...
Python

Iterate over MP4 atoms

This script yields the atoms contained in an MP4 file. Mostly is used for extracting the tags contained in it (artist, title etc) using a convenience class (M4ATags). This script could be implemented as an generator. ...
Python

Iterating through large file like objects

This function provides a simple iterator for the lines of a file-like object. (It also provides a flag for removing/retaining trailing newlines.) I ran into the problem a number of times that I wanted to read-in a very large file-like object (say a GB or two) line by line. This is ...
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

Parsing out EDI messages

A parser I designed to work with HIPAA EDI files. It reads in files and spits out the individual segments without terminators.Requires Python 2.3 or greater. (Use can probably use Python 2.2 with from __future__ import generators at the top...)This parser is currently in use to work with 150-200MB of EDI ...
Python

Progress bar class

Here is a little class that lets you present percent complete information in the form of a progress bar using the '#' character to represent completed portions, space to represent incomplete portions, and the actual percent done (rounded to integer) displayed in the middle:[############# 33% >   [##;             & nbsp;            ] When you initialize the class, ...
Python

Python replacement for java util Properties

This script provides a quick and easy way to process Java properties files using pure Python. Of course, Jython can always be used, but in situations where Jython cannot be used, this recipe provides a sure-fire drop-in replacement.The Properties class is modelled to duplicate the behaviour of the original as closely ...
Python

Quicken QIF file class and conversion

This script contains a simple class to represent a Quicken (QIF) file, and a parser to load a QIF file into a sequence of those classes. ...
Python

Recover files from damaged media

Files existing on damaged media (eg old CD-ROMs) are not completely lost. Often, readers will read sectors unreadable in other readers.The "trick" shown by this script is to merge the successful reads from several devices. ...
Python

Recursive directory listing in HTML

This script contains a function that walks a directory path, listing the files and directories in HTML format. It can sometimes be handy to get a look at an entire directory tree, and HTML is a good way to display it. This script goes through the directory tree using os.path.walk in ...
Python

Regexplace

This script search and replace files in a directory, recursively. File name and search string can be a regular expression.Execution can be simulated, step by step, and are always shown changed files/lines. ...
Python

Relative filepath

This script returns a relative path to the target from either the current directory or an optional base directory. Base can be a directory specified either as absolute or relative to current directory. ...
Python