Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import maya.cmds as cmds
- import maya.mel as mel
- import shutil
- import os
- import sys
- _ExtDrive_Path = "C:\Users\kflynn\Google Drive\Twenty2CansHappyAnims"
- def Archive_Me_To_Gdrive():
- ExternalPathExists = os.path.exists( _ExtDrive_Path )
- if ExternalPathExists is True:
- Current_File = cmds.file( sn=True , query=True)
- FileName = FileNameStrip_gdrive( Current_File )
- mel.eval( 'ArchiveScene;' )
- Exists_test = cmds.file( ( Current_File + '.zip') , q=True, ex=True )
- if Exists_test is True:
- shutil.copyfile( ( Current_File + '.zip') , ( _ExtDrive_Path + "/" + FileName + '.zip' ) )
- ZipExists_test = cmds.file( ( _ExtDrive_Path + "/" + FileName + '.zip' ) , q=True, ex=True )
- if ZipExists_test is True:
- os.remove( ( Current_File + '.zip') )
- gui_message( 'Successfully copied file to gdrive location. - ' + ( FileName + '.zip' ) )
- else:
- gui_message( "File copy to External path seems to of failed? Possible disconnection?" )
- else:
- gui_message( ( "Zip archive file doesn't exist at file location - " + Current_File + " Aborting File copy") )
- else:
- gui_message( "External Path doesn't exist." )
- def FileNameStrip_gdrive( _FilePath ):
- tmp = _FilePath.split('/')
- tmp2 = tmp[-1]
- return tmp2
- def gui_message(message):
- if message:
- sys.stdout.write('# ' + ' - ' + message + ' #\n')
- Archive_Me_To_Gdrive()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement