API call to delete files?

Highlighted
New Contributor

API call to delete files?

Hello - I'm trying to remove multiple files from multiple users within Box. Manually this will take a very long time and I thought Box CLI may work. 

 

Have any of you done this before and can either guide me or supply me with a script that I edit for my specific request? 

 

Any assistance would be appreciated. 

 

Thanks!

3 REPLIES 3
Highlighted
Box Employee

Re: API call to delete files?

Hello @avctor

 

Great question! The CLI would definitely be a great tool to use here. 

 

Here's the command you would run: 

 

box files:delete FILEIDHERE

 

This does support using a bulk CSV and if you wanted to do that you'd create a .csv file with one column named ID. This would contain each file ID you wanted to delete. The command to run that would become: 

 

box files:delete --bulk-file-path=BULKFILEPATHHERE

 

Best, 

Highlighted
New Contributor

Re: API call to delete files?

You rock. Thank you for the quick reply. I'll look into and respond with my results. 

 

Highlighted
New Contributor

Re: API call to delete files?

Is there a way to introduce a wildcard? Deleting by file ID will work however we have several users that can changed the name and I believe that changes the file ID. 

 

Would a script be a better choice for this rather than CLI?