Skip to content

Purge empty parent folder#578

Merged
davidnewhall merged 5 commits intomainfrom
dn2_purge_parent
Feb 17, 2026
Merged

Purge empty parent folder#578
davidnewhall merged 5 commits intomainfrom
dn2_purge_parent

Conversation

@davidnewhall
Copy link
Copy Markdown
Collaborator

After Unpackerr extracts an item and a Starr app imports it, it waits a while before deleting the extracted content. Sometimes the download client moves the downloaded content before this cleanup action in Unpackerr happens. Previously, Unpackerr would delete the extracted content and leave behind the empty download folder.

This changes the behavior to delete the download folder if it's empty.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Unpackerr’s post-import cleanup so that after extracted content is deleted, it also attempts to remove now-empty parent directories (including the original download folder) to avoid leaving empty folders behind (closes #565).

Changes:

  • Extend delete requests to optionally define a “purge root” boundary for parent-folder cleanup.
  • Update the delete worker to iteratively purge empty parent directories up to a configured root.
  • Wire the new purge-root behavior into the Starr import cleanup path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
pkg/unpackerr/start.go Implements iterative empty-parent purging with an optional root boundary in the delete worker.
pkg/unpackerr/handlers.go Sends delete requests that purge empty parents up to the item’s download path after import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@davidnewhall davidnewhall merged commit 1aa1cf1 into main Feb 17, 2026
21 checks passed
@davidnewhall davidnewhall deleted the dn2_purge_parent branch February 17, 2026 07:03
alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Mar 2, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [Unpackerr/unpackerr](https://github.com/Unpackerr/unpackerr) | minor | `0.14.5` → `0.15.0` |

---

### Release Notes

<details>
<summary>Unpackerr/unpackerr (Unpackerr/unpackerr)</summary>

### [`v0.15.0`](https://github.com/Unpackerr/unpackerr/releases/tag/v0.15.0): Version 15 in 8 years

[Compare Source](Unpackerr/unpackerr@v0.14.5...v0.15.0)

#### New Features

- Folder setting `delete_after` has a default setting of 10 minutes.
- Log file mode can now be set.
- Will now unpack multi-file 7zip archives.
- Log file is now automatically created.
- FreeBSD rc.d improvements to allow overriding username.
- Progress updates are now logged. Every 15 seconds (configurable), the app logs the current extraction percentage.
- Adds `exclude_path` to the folder watcher so you can ignore specific paths.
- Folder setting `disable_recursion` works correctly now.
- Empty download folders are removed when archives are removed.
- Golift docker image now uses alpine instead of scratch.

##### These features are thanks to [@&#8203;oceanplexian](https://github.com/oceanplexian)

- Supports non-UTF8 file encoding (Japanese, Chinese, etc).
- Improved ISO9660 ([Joilet](kdomanski/iso9660#55)) support.
- [UDF](https://github.com/golift/udf) support (like ISO, but bigger).
- Splits FLAC/CUE files for Lidarr. **This is still experimental and feedback is requested.**
- Archives with an incorrect extension may still be extracted. We now detect the file type using the first few bytes.

#### Bug Fixes

It's a pretty big list, but at the end of the day all of the bugs pretty much lead to the same problem: extraction failed. A lot of these problems have been fixed and extractions are considerably more reliable.

#### Merged Contributions

- update arch pkgbuild by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;479](Unpackerr/unpackerr#479)
- update install.sh script by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;480](Unpackerr/unpackerr#480)
- add overrides for examples and docker by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;481](Unpackerr/unpackerr#481)
- Remove expanding of URL previews by [@&#8203;BoKKeR](https://github.com/BoKKeR) in [#&#8203;500](Unpackerr/unpackerr#500)
- docs: add clarify delete\_after needing to be greater than 0 by [@&#8203;bakerboy448](https://github.com/bakerboy448) in [#&#8203;485](Unpackerr/unpackerr#485)
- fix docs by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;501](Unpackerr/unpackerr#501)
- Update linter, fix some bugs by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;503](Unpackerr/unpackerr#503)
- set default for folder delete after to 10m by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;530](Unpackerr/unpackerr#530)
- Allows changing the log file mode. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;531](Unpackerr/unpackerr#531)
- add multi-file 7z support to starr apps by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;533](Unpackerr/unpackerr#533)
- make log file on linux auto. allow dir instead of file for log file by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;536](Unpackerr/unpackerr#536)
- Update FreeBSD rc file. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;538](Unpackerr/unpackerr#538)
- Provide progress updates. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;535](Unpackerr/unpackerr#535)
- feat(folder): add exclude\_paths for watched folders by [@&#8203;nicholaskurjo](https://github.com/nicholaskurjo) in [#&#8203;572](Unpackerr/unpackerr#572)
- fix(folder): honor disable\_recursion for watched archive files by [@&#8203;nicholaskurjo](https://github.com/nicholaskurjo) in [#&#8203;573](Unpackerr/unpackerr#573)
- Silence logs when nothing configured by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;574](Unpackerr/unpackerr#574)
- fix lint by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;577](Unpackerr/unpackerr#577)
- Logs fallback to stdout by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;579](Unpackerr/unpackerr#579)
- Purge empty parent folder by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;578](Unpackerr/unpackerr#578)
- Dockerfile changes + build fix by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;580](Unpackerr/unpackerr#580)
- Polish ISO9660 support: Starr app extraction, UDF, multi-extent by [@&#8203;oceanplexian](https://github.com/oceanplexian) in [#&#8203;581](Unpackerr/unpackerr#581)
- Add split\_flac toggle for Lidarr CUE+FLAC splitting by [@&#8203;oceanplexian](https://github.com/oceanplexian) in [#&#8203;583](Unpackerr/unpackerr#583)
- fixes by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;584](Unpackerr/unpackerr#584)
- Manually import FLAC tracks into Lidarr after they're split. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;586](Unpackerr/unpackerr#586)

#### Auto Updates

- Update module github.com/prometheus/client\_golang to v1.20.5 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;483](Unpackerr/unpackerr#483)
- Update module golang.org/x/mod to v0.20.0 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;482](Unpackerr/unpackerr#482)
- Update module golang.org/x/mod to v0.22.0 - autoclosed by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;490](Unpackerr/unpackerr#490)
- Update module github.com/fsnotify/fsnotify to v1.8.0 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;498](Unpackerr/unpackerr#498)
- chore(deps): update dependency go to v1.23.4 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;506](Unpackerr/unpackerr#506)
- Update GitHub Artifact Actions (major) by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;551](Unpackerr/unpackerr#551)
- fix(deps): update golift.io/rotatorr digest to [`f6ac6fc`](Unpackerr/unpackerr@f6ac6fc) by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;575](Unpackerr/unpackerr#575)
- fix(deps): update module golift.io/cnfg to v0.2.4 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;576](Unpackerr/unpackerr#576)
- Update module golift.io/cnfg to v0.2.5 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;585](Unpackerr/unpackerr#585)
- Update GitHub Artifact Actions (major) by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;588](Unpackerr/unpackerr#588)

#### New Contributors

- [@&#8203;BoKKeR](https://github.com/BoKKeR) made their first contribution in [#&#8203;500](Unpackerr/unpackerr#500)
- [@&#8203;nicholaskurjo](https://github.com/nicholaskurjo) made their first contribution in [#&#8203;572](Unpackerr/unpackerr#572)
- [@&#8203;oceanplexian](https://github.com/oceanplexian) made their first contribution in [#&#8203;581](Unpackerr/unpackerr#581)

**Full Changelog**: <Unpackerr/unpackerr@v0.14.5...v0.15.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNS43IiwidXBkYXRlZEluVmVyIjoiNDMuMjUuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW1hZ2UiXX0=-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4348
Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net>
Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Mar 2, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [golift/unpackerr](https://github.com/Unpackerr/unpackerr) | minor | `0.14.5` → `0.15.0` |

---

### Release Notes

<details>
<summary>Unpackerr/unpackerr (golift/unpackerr)</summary>

### [`v0.15.0`](https://github.com/Unpackerr/unpackerr/releases/tag/v0.15.0): Version 15 in 8 years

[Compare Source](Unpackerr/unpackerr@v0.14.5...v0.15.0)

##### New Features

- Folder setting `delete_after` has a default setting of 10 minutes.
- Log file mode can now be set.
- Will now unpack multi-file 7zip archives.
- Log file is now automatically created.
- FreeBSD rc.d improvements to allow overriding username.
- Progress updates are now logged. Every 15 seconds (configurable), the app logs the current extraction percentage.
- Adds `exclude_path` to the folder watcher so you can ignore specific paths.
- Folder setting `disable_recursion` works correctly now.
- Empty download folders are removed when archives are removed.
- Golift docker image now uses alpine instead of scratch.

##### These features are thanks to [@&#8203;oceanplexian](https://github.com/oceanplexian)

- Supports non-UTF8 file encoding (Japanese, Chinese, etc).
- Improved ISO9660 ([Joilet](kdomanski/iso9660#55)) support.
- [UDF](https://github.com/golift/udf) support (like ISO, but bigger).
- Splits FLAC/CUE files for Lidarr. **This is still experimental and feedback is requested.**
- Archives with an incorrect extension may still be extracted. We now detect the file type using the first few bytes.

##### Bug Fixes

It's a pretty big list, but at the end of the day all of the bugs pretty much lead to the same problem: extraction failed. A lot of these problems have been fixed and extractions are considerably more reliable.

##### Merged Contributions

- update arch pkgbuild by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;479](Unpackerr/unpackerr#479)
- update install.sh script by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;480](Unpackerr/unpackerr#480)
- add overrides for examples and docker by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;481](Unpackerr/unpackerr#481)
- Remove expanding of URL previews by [@&#8203;BoKKeR](https://github.com/BoKKeR) in [#&#8203;500](Unpackerr/unpackerr#500)
- docs: add clarify delete\_after needing to be greater than 0 by [@&#8203;bakerboy448](https://github.com/bakerboy448) in [#&#8203;485](Unpackerr/unpackerr#485)
- fix docs by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;501](Unpackerr/unpackerr#501)
- Update linter, fix some bugs by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;503](Unpackerr/unpackerr#503)
- set default for folder delete after to 10m by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;530](Unpackerr/unpackerr#530)
- Allows changing the log file mode. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;531](Unpackerr/unpackerr#531)
- add multi-file 7z support to starr apps by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;533](Unpackerr/unpackerr#533)
- make log file on linux auto. allow dir instead of file for log file by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;536](Unpackerr/unpackerr#536)
- Update FreeBSD rc file. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;538](Unpackerr/unpackerr#538)
- Provide progress updates. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;535](Unpackerr/unpackerr#535)
- feat(folder): add exclude\_paths for watched folders by [@&#8203;nicholaskurjo](https://github.com/nicholaskurjo) in [#&#8203;572](Unpackerr/unpackerr#572)
- fix(folder): honor disable\_recursion for watched archive files by [@&#8203;nicholaskurjo](https://github.com/nicholaskurjo) in [#&#8203;573](Unpackerr/unpackerr#573)
- Silence logs when nothing configured by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;574](Unpackerr/unpackerr#574)
- fix lint by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;577](Unpackerr/unpackerr#577)
- Logs fallback to stdout by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;579](Unpackerr/unpackerr#579)
- Purge empty parent folder by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;578](Unpackerr/unpackerr#578)
- Dockerfile changes + build fix by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;580](Unpackerr/unpackerr#580)
- Polish ISO9660 support: Starr app extraction, UDF, multi-extent by [@&#8203;oceanplexian](https://github.com/oceanplexian) in [#&#8203;581](Unpackerr/unpackerr#581)
- Add split\_flac toggle for Lidarr CUE+FLAC splitting by [@&#8203;oceanplexian](https://github.com/oceanplexian) in [#&#8203;583](Unpackerr/unpackerr#583)
- fixes by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;584](Unpackerr/unpackerr#584)
- Manually import FLAC tracks into Lidarr after they're split. by [@&#8203;davidnewhall](https://github.com/davidnewhall) in [#&#8203;586](Unpackerr/unpackerr#586)

##### Auto Updates

- Update module github.com/prometheus/client\_golang to v1.20.5 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;483](Unpackerr/unpackerr#483)
- Update module golang.org/x/mod to v0.20.0 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;482](Unpackerr/unpackerr#482)
- Update module golang.org/x/mod to v0.22.0 - autoclosed by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;490](Unpackerr/unpackerr#490)
- Update module github.com/fsnotify/fsnotify to v1.8.0 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;498](Unpackerr/unpackerr#498)
- chore(deps): update dependency go to v1.23.4 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;506](Unpackerr/unpackerr#506)
- Update GitHub Artifact Actions (major) by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;551](Unpackerr/unpackerr#551)
- fix(deps): update golift.io/rotatorr digest to [`f6ac6fc`](Unpackerr/unpackerr@f6ac6fc) by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;575](Unpackerr/unpackerr#575)
- fix(deps): update module golift.io/cnfg to v0.2.4 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;576](Unpackerr/unpackerr#576)
- Update module golift.io/cnfg to v0.2.5 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;585](Unpackerr/unpackerr#585)
- Update GitHub Artifact Actions (major) by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;588](Unpackerr/unpackerr#588)

##### New Contributors

- [@&#8203;BoKKeR](https://github.com/BoKKeR) made their first contribution in [#&#8203;500](Unpackerr/unpackerr#500)
- [@&#8203;nicholaskurjo](https://github.com/nicholaskurjo) made their first contribution in [#&#8203;572](Unpackerr/unpackerr#572)
- [@&#8203;oceanplexian](https://github.com/oceanplexian) made their first contribution in [#&#8203;581](Unpackerr/unpackerr#581)

**Full Changelog**: <Unpackerr/unpackerr@v0.14.5...v0.15.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNS43IiwidXBkYXRlZEluVmVyIjoiNDMuMjUuNyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW1hZ2UiXX0=-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4349
Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net>
Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Empty folder left behind

2 participants