Skip to content

Instantly share code, notes, and snippets.

View amdsobhy's full-sized avatar

Ahmed Sobhy amdsobhy

  • Canada
View GitHub Profile
@danielgindi
danielgindi / delete_bitbucket_lfs_files.js
Last active November 8, 2024 17:14
Bulk delete Bitbucket LFS files
(() => {
// Run this in Chrome's console, while in Bitbucket's website and logged in
const csrftoken = document.cookie.match(/\bcsrftoken=(.*?)(?:;| |$)/)[1];
const repoName = window.__initial_state__.section.repository.currentRepository.full_name;
const expiry = 1000 * 60 * 60; // Delete only files older than an hour
let page = 1;
function iterateNext() {
fetch(`https://bitbucket.org/${repoName}/admin/lfs/file-management/?iframe=true&spa=0&page=${page}`, {