Skip to content

Instantly share code, notes, and snippets.

@fillup
Last active August 29, 2015 14:05
Show Gist options
  • Save fillup/1c97d29bd75ac004b4b1 to your computer and use it in GitHub Desktop.
Save fillup/1c97d29bd75ac004b4b1 to your computer and use it in GitHub Desktop.
Manually batch delete files from Filepicker.io account.

I recently needed to batch delete all of the files in my filepicker.io account, but there is no way to do that through their UI or APIs, at least that I could find (unless you still have all their IDs in your own database in which this is not necessary). In their Developer Console I can browse the files in the account and delete each one individually, but that would take an extremely long time for hundreds or thousands of files.

My solution is still a bit slow and manual, but much much faster than clicking each one individually. This is a simple javascript snippet that can be run in your browser developer console on the Browse Files page when logged into Filepicker.io

$('.filelink').each(function(index){
   var url = window.location+'/remove/';
   var handle = $(this).attr('data-handle');
   $.post(url,{handle: handle}, function(response){
     console.log(handle);
   });
});
window.location.reload();

Each time you run that it will delete all the files and reload the page, which will present a new list of files. So the quickest way to work through them is to kepe your focus on the developer console and repeatedly press UP then Return/Enter to execute it, over and over and over again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment