mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 08:25:54 +02:00
[GH-ISSUE #890] Feature: Preserve subfolder structure when scanning external folders. #610
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy-maziggy-1#610
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SMAW on GitHub (Apr 4, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/890
Originally assigned to: @maziggy on GitHub.
Problem or Use Case
Currently, when scanning an external folder with
scan_external_folder, all files (including those in subdirectories) are imported flat into the root LibraryFolder in Bambuddy. The subfolder structure as found on disk is ignored, and the UI shows a single large folder with all files. This reduces organization and makes navigating large or sorted external sources difficult.Proposed Solution
Improve
scan_external_folderto automatically mirror the real folder structure into Bambuddy's LibraryFolder tree. For each directory/subdirectory under the external path, create corresponding LibraryFolder(s) with correct parent/child relationships (is_external=True) and assign imported files to the correct folder according to their disk location. Subfolders no longer present on disk should be automatically removed from the database if empty.IMPORTANT: All code below was generated by AI (Claude Opus 4.6). I am NOT a developer, so please carefully review and validate before adopting!
1. Add a folder cache and resolve/create subfolders during the walk
In
scan_external_folderinbackend/app/api/routes/library.py, add afolder_cacheand resolve subdirectories into LibraryFolder children:2. Update existing file tracking to include subfolders
The current
existing_filesquery only checksfolder_id == folder_id. It needs to include files in all child external subfolders:3. Clean up empty subfolders no longer on disk
After removing orphaned files, also prune child external folders whose directories are gone:
4. Tests to update
test_scan_discovers_files— the nestedsubfolder/nested.stlshould now be in a child folder, not the root folder.Alternatives Considered
Continue importing everything flat into one folder, but this makes file management much harder.
Feature Category
File Manager
Priority
Would improve my workflow
Mockups or Examples
N/A
Contribution
Checklist
@maziggy commented on GitHub (Apr 5, 2026):
Available/Fixed in branch dev and available with the next release or daily build.
If you find Bambuddy useful, please consider giving it a ⭐ on GitHub — it helps others discover the project!