Remove empty folders
Clear out folders holding nothing
The removal half of the Empty folder report. It finds every empty folder in the scope you pick, including the ones that only become empty once the empty folders inside them have gone, shows you the whole list, and removes only what you approve.
What it does
- Which folders would go, in full, before any of them do.
- Which are empty outright and which become empty as a consequence, which is why a first look at a library undercounts.
- What a cut-off date would protect, if you want recently touched folders left alone.
- What actually happened per folder, including any that had gained a file since the scan and were therefore left alone.
How it runs
- Sign in and pick a scope. Sites, libraries or individual folders.
- Set the options. Include subsites, and optionally a cut-off date.
- It scans, bottom up. Deepest folder outwards, which is what finds the folders that only become empty once their children go.
- Approve the list. You see every folder before anything moves, and can untick any of them. Unticking a folder also unticks the folders above it, which would no longer be empty.
- It removes. Each folder is re-checked immediately before it is touched, and anything no longer empty is left alone and reported. Cancel offers Finish the current item, Stop now, or Keep running. Nothing is left half-written: an item is either done or not started.
How it works
Each library in scope is read once, collecting every folder and which folder each file sits in. The library's Forms folder and everything under it are excluded. A library that cannot be read, or whose read stops part way, contributes nothing to the list rather than a partial one. A folder counts as removable when it holds no files of its own and every folder inside it is removable too, which is how a whole branch of empty folders is found in one pass. With a cut-off date, a folder last modified after it is kept, and so is every folder above it, since they still contain it; the report says why they were kept.
Every folder found is listed for approval and ticked by default. Unticking a folder also unticks every listed folder above it, because those cannot be removed while it stays. Only the ticked folders go forward.
Removal works through one site at a time and, within it, the deepest level first, one level at a time. Immediately before removal each folder is read again, and it is removed only if SharePoint says it holds no files and no folders at that moment. A folder that has gained anything since the scan is left alone and reported as no longer empty, and because a folder that stays is still inside its parent, the parent is then spared as well. A folder already gone is counted on its own, and one that fails is reported with SharePoint's reason while the run carries on.
From this screen folders always go to the site recycle bin; no permanent option is offered. What each level is about to remove is recorded on this computer before it is sent, and the outcome for every folder afterwards. A stopped run keeps the count of what it already removed, and the clean-up record goes into Report History whether or not you save it. Files are never removed by this tool: it only ever removes folders it has just confirmed are empty.
What you need
- Write access to the libraries in scope.
What it will not do
- Folders go to the recycle bin, so a mistake is recoverable for about 93 days.
- A folder holding only hidden or system items is not empty and is not touched.
- Run the Empty folder report first if you want to circulate the list before anyone approves it.