0
python을 사용하여 폴더 자체를 삭제하지 않고 폴더 내의 모든 파일과 디렉토리를 삭제하는 가장 좋은 방법은 무엇입니까? 사용 :python 모든 파일을 (재귀 적으로) 폴더 자체없이 삭제
if os.path.exists("path/to/folder"):
shutil.rmtree("path/to/folder/*")
윌하지 rmtree 이후 트릭() UNIX 스타일 (/ *)를 이해하지 못한다. rmtree 자체는 괜찮지 만 폴더가 삭제되었으므로 필요하지 않습니다.
http://stackoverflow.com/questions/185936/delete-folder-contents-in-python – Aditya