How To Create a Timer that deletes object from file api?

Hello, I, ve created a Timer that deletes objects that lasted more than one month from database table , now my problem is each object has two images stored in the files api, i want to delete those images too, till now i am able to delete objects from database table but i dont know how to delete images related to those objects?

This is the code i am using to delete objects :
execute(req){
let queryBuilder = Backendless.DataQueryBuilder.create();
queryBuilder.setWhereClause( created >= '${Date.now() - 30*24*60*60*1000}' )
queryBuilder.setSortBy( ‘created desc’ )
queryBuilder.setPageSize(100)
return Backendless.Data.of( ‘PropertyModels’ ).find( queryBuilder )
.then( data => {
if( data.length > 0 ) {
return Backendless.Data.of( ‘PropertyModels’ ).bulkDelete( created >= '${Date.now() - 30*24*60*60*1000}')
}
})
.catch( function( error ) {
console.log( "Server reported an error " + error )
})
}

Based on what you described, the algorithm would be:

  1. Retrieve the objects you want to delete
  2. Start a loop to iterate over the objects from (1). For each object:
  3. Get the URL of the first image
  4. Delete the image at the URL from (3)
  5. Get the URL of the second image
  6. Delete the image at the URL from (5)
  7. Delete the object

Regards,
Mark

Ok, thanks