Exemple #1
0
def backup( currentPath, serverPath, *args ):
    
    backupFolderPath, fileName = getBackupPath( serverPath )
    #print "before : ", backupFolderPath+'/'+fileName
    backupFileName = checkSamePathAndRenamePath( backupFolderPath+'/'+fileName )
    
    if os.path.exists( serverPath ):
        shutil.copy2( serverPath, backupFileName )
        print "from    : ", serverPath
        print "copy to : ", backupFileName
    
    serverFolderName, serverFileName = separateFolderAndfile( serverPath )
    currentFileName = ''
    if serverFileName:
        currentFileName = serverFileName
    else:
        currentFileName = 'temp.mb'
        
    if not os.path.exists( currentPath ):
        nowTime = datetime.datetime.now()
        folderName ='%04d%02d%02d' %( nowTime.year, nowTime.month, nowTime.day )
        filePath = model.defaultFileBrowserPath+'/'+folderName+'/'+currentFileName
        currentPath = checkSamePathAndRenamePath( filePath )
    
    functions.makePath( '/'.join( currentPath.split( '/' )[:-1] ) )
    print cmds.file( q=1, sceneName=1 )
    cmds.file( rename=currentPath )
    cmds.file( save=1 )
    
    if currentPath.replace( '\\', '/' ).strip() == serverPath.replace( '\\', '/' ).strip(): return None
    shutil.copy2( currentPath, serverPath )
Exemple #2
0
def saveAndUpdate(currentPath, serverPath):

    backupFolderPath, fileName = getBackupPath(serverPath)
    #print "before : ", backupFolderPath+'/'+fileName
    backupFileName = checkSamePathAndRenamePath(backupFolderPath + '/' +
                                                fileName)

    if os.path.exists(serverPath):
        shutil.copy2(serverPath, backupFileName)
        print "from    : ", serverPath
        print "copy to : ", backupFileName

    serverFolderName, serverFileName = separateFolderAndfile(serverPath)
    currentFileName = ''
    if serverFileName:
        currentFileName = serverFileName
    else:
        currentFileName = 'temp.mb'

    if not os.path.exists(currentPath):
        nowTime = datetime.datetime.now()
        folderName = '%04d%02d%02d' % (nowTime.year, nowTime.month,
                                       nowTime.day)
        filePath = model.defaultFileBrowserPath + '/' + folderName + '/' + currentFileName
        currentPath = checkSamePathAndRenamePath(filePath)

    functions.makePath('/'.join(currentPath.split('/')[:-1]))
    cmds.file(rename=currentPath)
    cmds.file(save=1)

    shutil.copy2(currentPath, serverPath)
Exemple #3
0
def getBackupPath(serverPath):

    serverSplit = serverPath.replace('\\', '/').split('/')
    nowTime = datetime.datetime.now()
    folderName = '%04d%02d%02d' % (nowTime.year, nowTime.month, nowTime.day)
    backupPath = '/'.join(serverSplit[:-1]) + '/backup/%s' % folderName
    functions.makePath(backupPath)
    return backupPath, serverSplit[-1]
Exemple #4
0
def getBackupPath( serverPath ):
    
    serverSplit = serverPath.replace( '\\', '/' ).split( '/' )
    nowTime = datetime.datetime.now()
    folderName ='%04d%02d%02d' %( nowTime.year, nowTime.month, nowTime.day )
    backupPath = '/'.join( serverSplit[:-1] )+'/backup/%s' % folderName
    functions.makePath( backupPath )
    return backupPath, serverSplit[-1]
Exemple #5
0
def copyFromServerAndOpen( path, *args ):
    
    splitPath = path.replace( '\\', '/' ).split( '/' )
    
    fileName = splitPath[-1]
    
    nowTime = datetime.datetime.now()
    folderName ='%04d%02d%02d' %( nowTime.year, nowTime.month, nowTime.day )
    
    currentFolderPath = model.defaultFileBrowserPath +"/"+ folderName
    functions.makePath( currentFolderPath )
    
    currentFilePath = checkSamePathAndRenamePath( currentFolderPath+'/'+fileName )
    print "currentFilePath : ", currentFilePath
    
    shutil.copy2( path, currentFilePath )
    cmds.file( currentFilePath, f=1, options="v=0;" , ignoreVersion=1, o=1 )
Exemple #6
0
def copyFromServerAndOpen(path, *args):

    splitPath = path.replace('\\', '/').split('/')

    fileName = splitPath[-1]

    nowTime = datetime.datetime.now()
    folderName = '%04d%02d%02d' % (nowTime.year, nowTime.month, nowTime.day)

    currentFolderPath = model.defaultFileBrowserPath + "/" + folderName
    functions.makePath(currentFolderPath)

    currentFilePath = checkSamePathAndRenamePath(currentFolderPath + '/' +
                                                 fileName)
    print "currentFilePath : ", currentFilePath

    shutil.copy2(path, currentFilePath)
    cmds.file(currentFilePath, f=1, options="v=0;", ignoreVersion=1, o=1)
Exemple #7
0
def findScenePath(cutPath):

    sceneFolder = functions.makePath()
Exemple #8
0
def findScenePath( cutPath ):
    
    sceneFolder = functions.makePath(  )