def _purge_folder(folder, app, remove_from_disk, info_only=False):
 for ld in folder.datasets:
  print('Deleting library dataset id ', ld.id)
  ld.deleted = True
  for ldda in ([ld.library_dataset_dataset_association] + ld.expired_datasets):
   _purge_dataset_instance(ldda, app, remove_from_disk, info_only=info_only)
 for sub_folder in folder.folders:
  _purge_folder(sub_folder, app, remove_from_disk, info_only=info_only)
 if (not info_only):
  print('Purging folder id ', folder.id)
  folder.purged = True
  app.sa_session.add(folder)
  app.sa_session.flush()

def _purge_folder ( folder , app , remove_from_disk , info_only = False ) : for ld in folder . datasets : print ( 'Deleting library dataset id ' , ld . id ) ld . deleted = True for ldda in ( [ ld . library_dataset_dataset_association ] + ld . expired_datasets ) : _purge_dataset_instance ( ldda , app , remove_from_disk , info_only = info_only ) for sub_folder in folder . folders : _purge_folder ( sub_folder , app , remove_from_disk , info_only = info_only ) if ( not info_only ) : print ( 'Purging folder id ' , folder . id ) folder . purged = True app . sa_session . add ( folder ) app . sa_session . flush ( )
purges a folder and its contents .