# -*- 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[2])
        path = (sys.argv[3])

    workPath = '/Prod//Projects/' + '/' + project + '/' +  '/shots/' + '/' + path + '/' + '/render/' + '/REN/'
    
    localPath = localMount + workPath
    networkPath = networkMount + workPath

    if sys.argv[1] == 'update':
        if os.listdir(networkPath) != os.listdir(localPath):
            copyfile = shutil.copyfile(networkPath, localPath)
            
    elif sys.argv[1] == 'copy':    
        if os.path.exists(localPath) == 0:
            copytree = shutil.copytree(networkPath, localPath, symlinks=True, ignore=None)

    if sys.argv[1] not in  ('update', 'copy'):
        print 'Error, please enter the command: "update" or "copy"'
 

if __name__ == "__main__":
    checkRead()
