Clean up a directory tree

License: Freeware
Date Added: 19 December, 2012
Category: Scripts / File Manipulation
Author: activestate.com

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.


Advertisements



 

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 clean directories with non-empty sub-directories. I work on windows and many times in the week, need to copy and delete a big file system from the network to my machine. If I perform deletion using Windows Explorer, it takes a long time and also pops up unnecessary dialogs. The python script did it about 60% faster than explorer and about 10% faster than MKS tool-kit's 'rm -rf' command. 


Operating Systems:  Python, Windows, Linux, BSD, Solaris, Mac OS


Clean up a directory tree Related Downloads
 
Download Magican File 1.2.0

Magican File 1.2.0  Magican File is updated to help Mac users to find files more quickly. It can copy, cut, paste, delete, compress, creat files and folders, still features of searching files, looking file property and opening terminal are also available.

Download FSList 1.0

FSList 1.0  This script allows you to manage a list of files, directories and other  file system objects. Optionally recurses directories and ensure that each item in the list is a regular file.

Download Flexible directory walking 1.1

Flexible directory walking 1.1  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.

Download Extracting Windows file versions 1.6

Extracting Windows file versions 1.6  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).

Download Slither 1.0

Slither 1.0  This script searches your hard drive for all files specified and generates an HTML web page list of the files found and links to the file itself. This search is fast and very little code to complete the task.

Download Parsing binary files with regular expressions 1.0

Parsing binary files with regular expressions 1.0  This script allows you to use the regular expression engine to parse binary files, especially those for which the struct module alone is inadequate.The typical way to parse binary data in Python is to use the unpack method of the struct module.

Download Zip and Pickle 1.0

Zip and Pickle 1.0  This module saves and reloads compressed representations of generic Python objects to and from the disk.

Download Simple md5 sum utility 1.0

Simple md5 sum utility 1.0  This script is a simple md5 hash utility for generating md5 checksums of files. &lthash utilThis mainly useful for systems without an included "md5sum" utility, like OS-X and Win32.

Download Copying and Pasting Directories and Files 1.0

Copying and Pasting Directories and Files 1.0  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.

File Manipulation Popular Downloads
 
Download Free File Splitter Joiner 5.5.5

Free File Splitter Joiner 5.5.5  Free file splitter joiner software to split any file into smaller pieces for easier transfer, storage and file management, and then rejoin them later for use.

Download Parsing a full file specification 1.1

Parsing a full file specification 1.1  This function parses a full file specification into tuple of: a) list of drive and folders b) file name c) (last) file extension (including dot)A full file specification consists of drive letter, folders, file name, and extension.

Download php Download Manager 1.1

php Download Manager 1.1  php Download Manager is a script package written in php with a MySQL back-end. The script allows site owners to offer downloads by category. The program generates code to link to categories or individual downloads.

Download basE91 0.6.0

basE91 0.6.0  basE91 is an advanced method for encoding binary data as ASCII characters. It is similar to UUencode or base64, but is more efficient.The overhead produced by basE91 depends on the input data.

Download aria2 0.11.4

aria2 0.11.4  aria2 is a download utility with resuming and segmented downloading. Supported protocols are HTTP/HTTPS/FTP/BitTorrent. It also supports Metalink version 3.0. As of 0.10.

Download Progress bar class 1.0

Progress bar class 1.0  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)

Download PKZip library for PHP 0.4.1

PKZip library for PHP 0.4.1  PKZip library for PHP contains a set of functions to create PKZip (Winzip) files in PHP.

Download MyDMS 1.7.0

MyDMS 1.7.0  MyDMS is an open-source, web-based document management system written in PHP and supported by an SQL database. Originally coded by Markus Westphal, MyDMS provides document meta-data, version control, security and easy access to your documents.

Download PHPFileManager7 1.0

PHPFileManager7 1.0  PHPFileManager7 is a PHP class. PFM is an easy to use files manager. It doesn't require a MySQL database.

Submit Reviews for Clean up a directory tree
- required fields