I want delete files on a folder and I have an error.
My code
for f in glob ('sub/*.sub'):
subprocess.call(["php", "AES.class.php" , f])
shutil.rmtree(f)
#deplacement des fichier
for d in glob ('*.ass'):
shutil.move(d, 'sync')
It gives me the following error:
Traceback (most recent call last):
File "start.py", line 26, in <module>
shutil.rmtree(f)
File "/usr/lib64/python2.7/shutil.py", line 239, in rmtree
onerror(os.listdir, path, sys.exc_info())
File "/usr/lib64/python2.7/shutil.py", line 237, in rmtree
names = os.listdir(path)
OSError: [Errno 20] Not a directory: 'sub/Ep01.sub'
How to delete the files with extension .sub
in folder?