I know two methods of copying a directory recursively from source to destination.
1) cp -r <source> <destination>
2) shutil.copytree(<source>, <destination>)
Method 1 is linux standard method. method 2 is pythonic way of copying a directory by importing shutil
module within a python script.
Can anyone explain me any significant/fundamental difference between working of the two ? Which one is faster ? Which one is safer ? Since i can run cp -r
command from within python script by python's os.system()
function, i want to know which method should i use if i want to copy directories within a python script ?