To delete a directory with all contained files I chose the usage of shutil as common.
import shutil
from os.path import exists
if exists(path_dir):
shutil.rmtree(path_dir)
Unfortunatelly my solution does not work throwing the following error.
FileNotFoundError: [Errno 2] No such file or directory: '._image1.jpg'
A quick search showed that I'm not alone having this problem. Comparable, still unsolved question can be found here. In my understanding rmtree is equivalent to rm -Rf $DIR which now seems not to be the case.
Any ideas appreciated.
p.s. for reconstruction purposes. Please create a symbolic link for example using ln -s /path/to/original /path/to/link
from Delete directory and all symlinks recursively
No comments:
Post a Comment