Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] move_files should optionally clean up empty directories #5631

Open
DuctTape42 opened this issue Jan 27, 2025 · 2 comments
Open

[Feature] move_files should optionally clean up empty directories #5631

DuctTape42 opened this issue Jan 27, 2025 · 2 comments

Comments

@DuctTape42
Copy link

Is your feature request related to a problem? Please describe.
I've written a plugin that works like RoU to move files around in my stash instance. It uses move_files to move the files. This may leave empty directories behind. While it's possible to clean up the directories from inside the plugin (rmdir on empty directories), they remain in stash's folder table. The only way to remove them is to run Clean afterward. Running Clean is a little scary because it's such a broad and destructive operation.

Describe the solution you'd like
It would be nice of move_files took a flag to optionally remove the source directory when moving a file (if it's empty). If that folder is empty, it should recursively remove parent directories (up to the respective stash library root) if they're empty.

Describe alternatives you've considered
The problem I want to solve isn't to remove the directories; just to clean up stash. So adding a flag to Clean to just clean up missing directories (so there's no risk of accidentally deleting scenes) would probably be sufficient.

Alternatively there could be a new mutation to delete the folders directly (either do the rmdir and remove them from the folder table or just remove them from the folder table). This seems sufficient, but too hokey.

@stg-annon
Copy link
Collaborator

you can run a selective clean for just the directories you know to be empty

@DuctTape42
Copy link
Author

That's a good suggestion. I'll try that.

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

No branches or pull requests

2 participants