Hello everybody !
wow my first time on danyweb ! ;p
Well, here the deal.
Im doing a script that basically copy and past into the local drive a specified directory with all this files.
Im doing the copy with a copytree which is working well.
But, (and I know it will not work as copytree dont update directory) Im, like, stuck when I have to update the directory.
For a better understanding here what the tree look like:
and sometime as we have to rerender, we update the "render" folder with a v002:
So, actually my script can copy my G:/prod/actual/project/xxx/shot/shot_EN_006/render/v001 directory to C:/prod/actual/project/xxx/shot/shot_EN_006/render/v001
but I dont know how to proceed to update this folder when asked.
Here the actual script, as you can see the update part will not work.
# -*- coding: utf-8 -*- import os import sys import threading import shutil def checkRead(): networkMount = 'D:/' localMount = 'C:/' for item in sys.argv: project = (sys.argv) path = (sys.argv) workPath = '/Prod//Projects/' + '/' + project + '/' + '/shots/' + '/' + path + '/' + '/render/' + '/REN/' localPath = localMount + workPath networkPath = networkMount + workPath if sys.argv == 'update': if os.listdir(networkPath) != os.listdir(localPath): copyfile = shutil.copyfile(networkPath, localPath) elif sys.argv == 'copy': if os.path.exists(localPath) == 0: copytree = shutil.copytree(networkPath, localPath, symlinks=True, ignore=None) if sys.argv not in ('update', 'copy'): print 'Error, please enter the command: "update" or "copy"' if __name__ == "__main__": checkRead()
Anyone can help me to figure out a solution please ?.
Thank you and have a good day !