Sunday, July 08, 2007

cleancvs.py

#cleancvs.py
#
#Remove directories or files with the name CVS
#
#Doesn't check whether the file it is deleting is a cvs directory. 
#And expects unix path seperators.
#
#usage:
#python cleancvs.py [path to clean]


import sys
import shutil

dir = sys.argv[1]

for basePath, files, directories in os.walk(dir):
    if basePath.endswith("/CVS"):
        shutil.rmtree(basePath)

1 Comments:

At 12:37 AM, Blogger Prasad.A said...

You could use this:

find /pathtodir -name "CVS" -print0 | xargs -0 rm -rf

 

Post a Comment

<< Home