File Management scripts - Top 4 Download

File Management script downloads

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

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

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

z directory

This script is a memory-based directory copier and paster. Pickled Directory objects will contain all data from a directory at path and can be saved in other locations.Once a Directory object has been created, pasting it to another location is ex has beenimple. ...
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

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

Automatic explicit file close

This script is a drop in replacement for open() function that automatically explicitly closes the file when its input is exhausted. ...
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

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

Cross Platform Excel Parsing With Xlrd

This script easily extract data from microsoft excel files using this wrapper class for xlrd. The class allows you to create a generator which returns excel data one row at a time as either a list or dictionary. This script is very useful for easily pulling in a variety of excel files without ...
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

Display an Image from a specified file

This script reads an image file from the filename specified as the first parameter on the command line and displays it on screen. It uses the PIL module so that it can load almost any image file type supported by that module and uses Tkinter to display the image on a ...
Python

Curses File Manager

Curses File Manager is a curses based filemanager loosely resembling emacs dired mode. ...
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

Upload Lite

Upload Lite allows your web site visitors to upload files to any directory on your server. You can set the file types you accept, the maximum size of any one file, have the user redirected to a page of choice after a successful upload, be notified of new uploads and more.Virtually ...