Last active
July 12, 2019 01:00
-
-
Save vmlaker/6a54a4cd86c739dbcd49b9aca2a297c8 to your computer and use it in GitHub Desktop.
Python command to archive Autodesk Shotgun projects by name, and make sure all archived projects are renamed with timestamp.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Archive the given projects. | |
for name in project_names: | |
project = sg.find_one('Project', [['name', 'is', name]]) | |
sg.update('Project', project['id'], {'archived': True}) | |
# Make sure all archived projects are named "delete_me_" + timestamp | |
for project in sg.find('Project', filters=[['archived', 'is', True]]): | |
if project['name'].startswith('delete_me_'): | |
continue | |
new_name = 'delete_me_{}_{}'.format(dt.datetime.now(), project['name']) | |
sg.update('Project', project['id'], {'name': new_name}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment