Adding tool mergerfs.consolidate-dirs #121
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure if this is of interest, but I have been missing such tool several times myself. For different reasons I have directories that has been split up that shouldn't be, and I figure this is the solution. It seems like more than me have thought that the existing consolidate tool does this. If you don't want to accept the pull request because you don't think the tool belongs, that's more than fine. I will then just keep it in my fork, primarily for myself, but also for others who look hard enough.
The tool takes the size per source device into consideration instead of just moving the data onto a random device, or the one with the most disk space available.
Pardon my Python. It's not my language and I use it about once per year only. I tried my best to follow your code standards and write as similar code as I could. Also, since I copy pasted quite a lot from the existing tools most of the code should be recognizable. I think I have cleaned out all unused functions.
Things it doesn't do that potentially would be wise:
rsync ... && rmdir <dir>
as a sub-process call. I guess one could argue that it would be better to call rsync and then unlink the directory using Python. I deliberately chose this approach though.