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

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -