def removeBackup():
    assert os.path.isdir(backup_dir), "Maya user backup does not exist: %s" % backup_dir
    
    print "restoring Maya user directory", app_dir

    tempdir = os.path.join(tempfile.gettempdir(), 'maya')
    if os.path.exists(tempdir):
        shutil.rmtree( tempdir )
    try:            
        shutil.move(app_dir, tempdir)
    except Exception, e:
            print('Error moving "%s" to temp dir for removal: "%s": %s' %
                   (app_dir, tempdir, e))
    
    else:
        try:
            shutil.rmtree( tempdir )
        except Exception, e:
            print('Error deleting "%s" - manually delete and rename/move "%s": %s' %
                   (tempdir, backup_dir, e))
        else:
            shutil.move( backup_dir, app_dir )
            print "done"
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/tests/pymel_test.py/removeBackup/original