R. David Murray added the comment:

See also issue 13229.

You can replicate 'rm -f' like this:

   for p in glob.glob('/dir/*'): 
      os.remove(p)

That doesn't seem worth an extra function.

The annoying one to emulate is 'rm -rf /dir/*', because with the current shutil 
tools you have to make different calls depending on whether the object is a 
file or a directory.  Pathlib doesn't help with that (it has no generic 
'remove' method that applies to both directories and files), but it does make 
the iteration easier.

----------
components: +Library (Lib) -IO
nosy: +pitrou, r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19642>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to