File Management Python scripts - Top 4 Download

File Management Python script downloads

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

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

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

Dir lower

This script lowers the case of all the items found in a specified directory. ...
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

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

Counting pages of PDF documents on Mac OS X

Given that PDF is a "native" data format on Mac OS X, it is very easy to get access to some properties of such documents. One is the number of pages. Using Python the necessary code to do this is only about four lines, plus some import and command-line plumbing, etc.This ...
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

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

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

Dupinator

Point this script at a folder or several folders and it will find and delete all duplicate files within the folders, leaving behind the first file found of any set of duplicates. It is designed to handle hundreds of thousands of files of any size at a time and to do ...
Python

Decorator

This script defines a "decorator" that, rather than decorating the function, calls it, passing it a file object that it had opened as the first argument.Of course, it makes sure to close the file upon the function's return (or nonreturn) with a try...finally block. One can use this decorator to get ...
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

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

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

Checks for a valid POSIX filename

Checks for a valid POSIX filename script allows you to check for a valid POSIX filename. ...
Python

A simple non recursive directory walker

This script is an equivalent of os.path.walk(), but without callback function. A simple directory walker, without the burden of creating a callback for os.path.walk().This is also usefull for incremental directory walking (where you want to scan remaining directories in subsequent calls). ...
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

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

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