I would like to move in python files and directories in one directory to another directory with overwrite ability.
I started with the following code:
(Python 3.6) From a previous answer (can't add comment)
I think that the line
if not os.path.isdir(node):
Should read
if not os.path.isdir(os.path.join(source, node))
Otherwise it will always return True and move the sub folders as well.
>>> import os
>>> import shutil
>>> for node in os.listdir(path):
... if not os.path.isdir(os.path.join(path, node)):
... shutil.move(os.path.join(path, node) , os.path.join(compteurfolder, node))