I am newbie to python, I am trying to achieve following task-
I have a directory WP_Test containing a sub-directory test, I want to copy all the files and folders inside this sub-directory test to another location.
I have following code but not working for me. Please try to help me achieving the solution to the task. Any help will be highly appreciated :)
def copytree(src, dst, symlinks=False, ignore=None):for item in os.walk(src).next()[1]:s = os.path.join(src, item)d = os.path.join(dst, item)if os.path.isdir(s):print("Found directory!")shutil.copytree(s, d, symlinks, ignore)else:shutil.copy2(s, d)
copytree("/home/user/Desktop/WP_Test", "/home/user/Desktop/something")