Skip to content

Instantly share code, notes, and snippets.

@liekkas
Created July 10, 2012 09:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liekkas/3082312 to your computer and use it in GitHub Desktop.
Save liekkas/3082312 to your computer and use it in GitHub Desktop.
python:删除指定的文件夹
# coding=utf-8
# 功能:删除某个文件夹下面所有的cvs文件夹
import os,shutil
# 删除某个项目里面所有为CVS的文件夹
def del_dirs(path):
for parent,dirnames,filenames in os.walk(path):
for dirname in dirnames:
if dirname == 'CVS':
p = os.path.join(parent,dirname)
shutil.rmtree(p)
del_dirs(r"D:\environment\liekkasspaceBak\workSpaceCharts")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment