python - Remove all files in a directory -
Trying to remove all files in a fixed directory gives me a follwing error:
< Code> ISError: [Aron 2] is not a file or directory: '/ home / me / test / *'
The code I'm running is:
< Pre> import os test = "/ home / me / test / *" os.remove (test)
os.remove () does not work on a directory, and os.rmdir () will only work on an empty directory.
You can use shutil.rmtree () to do this, though.
Comments
Post a Comment