File Management Python scripts - Top 4 Download

File Management Python script downloads

A Python script to test download mirrors

The concept of the script is straightforward: read the mirrors page from RedHat's web site, make a list of all the mirrors, test how long it takes to download from each, and present a sorted list of the results.The first task, reading and parsing the RedHat mirrors list, is handled with ...
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

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

Backup your files

Backup your files script makes backup versions for your files.It can be used for non-python source code also. ...
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

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

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

Checks for a valid POSIX filename

Checks for a valid POSIX filename script allows you to check for a valid POSIX filename. ...
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

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

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

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

Curses File Manager

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

Dir lower

This script lowers the case of all the items found in a specified directory. ...
Python

Directory Iterator

This script is an iterator that can be used to walk through directories.This class is intended to provide an iterator version of the os.listdir function. The interesting property of the iterator is that you can control if you want a deep iteration of directories with the 'deep' member.After having returned the path of ...
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

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

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

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