Skip to content

Instantly share code, notes, and snippets.

@vmlaker
Last active July 12, 2019 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmlaker/6a54a4cd86c739dbcd49b9aca2a297c8 to your computer and use it in GitHub Desktop.
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.
# 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