Over a million developers have joined DZone.

Using Path Module

·
Here's an example codes using path module.
You first need to download it here: path.py

# make some files excutable
d = path('/usr/home/guido/bin')
for f in d.files('*.py'):
    f.chmod(0755)

# Directory walking - delete Emacs backup files
d = path(os.environ['HOME'])
for f in d.walkfiles('*~'):
    f.remove()

Using os.path is difficult. I can hardly remember how to
use which method. Need to lookup the manual every time.
This path module is much much easier to use.
I've heard it will be included in python 2.5 as well.
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}