python递归删除空目录:
vi a1.py
#!/usr/bin/python
import os
dir="/root/python"
for root,dirs,files in os.walk(dir):
for f in dirs:
if not os.listdir(os.path.join(root,f)):
os.removedirs(os.path.join(root,f))
:wq
python a1.py
转载于:https://blog.51cto.com/yangzhiming/2128708