File Management scripts - Top 4 Download

File Management script downloads

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

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

C like iostream syntax in Python

This script represents a very simple proof-of-concept of an ostreams-like interface wrapping around file-like objects, included a demonstration of manipulators.Although theation of treams model does not make it necessary, it is quite easy to make a wrapper around file-like objects that behaves like the C ostreams'  insertion operator (e.g., cout Although ...
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

Zip and Pickle

This module saves and reloads compressed representations of generic Python objects to and from the disk. ...
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

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

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

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