import os
def (root_path):
if os.path.exists(root_path) == False:
print "folder %s not exits" % root_path
return
if os.path.isdir(root_path) == False:
print "folder %s is not a dir" % root_path
return
for root, subpaths, files in os.walk(root_path, False):
for file in files:
file_path = os.path.join(root, file)
print "delete file:%s" % file_path
os.remove(file_path)
print "delete dir:%s" % root
os.rmdir(root)
if __name__ == "__main__":
remove_dir("/Users/wpf/git/t")
近期评论