trapexit / mergerfs-tools

Optional tools to help manage data in a mergerfs pool
ISC License
372 stars 42 forks source link

Non recursive consolidator #95

Closed EricTheMagician closed 4 years ago

EricTheMagician commented 4 years ago

Following the discussion here: https://github.com/trapexit/mergerfs/issues/709

I want to move files around, but not the folders, to match this new policy, I just want to move my files around, not the subfolders. mergerfs.consolidate could work, but the rsync command is recursive so that my folders will get moved around too, because rsync will recurse on folders with the "-a" which implies recursion, but I could simply replace it with: "-lptgoD" (the same as -a without the recurse flag) which then won't recurse. This will likely work (correct me if I'm wrong), and could be useful for other people. If I make the changes: Should I give it a new name/tool? Or Should I change the description of the consolidator so that it reflects this since now not all the data will be a on a single drive?

trapexit commented 4 years ago

rsync isn't doing any recursion. The tool is. The easiest way to get it to act on one directory is to add a flag to disable the os.walk by setting dirs = [].

EricTheMagician commented 4 years ago

Got it. rsync is used to copy files, not folders, so the recursive option in rsync is meaningless.

trapexit commented 4 years ago

Doesn't mean your request is invalid. If you want it to only work on one directory rather than walking each sub directory I can add that.

EricTheMagician commented 4 years ago

It does what I want it to do. I didn't fully understand the code, so I had added a dry-run flag to look at what rsync was doing.

The description:

Consolidate files in a single mergerfs directory onto a single drive.

combined with the recursive flag made me think that all of the files and subfolders would be merged. Rather, the actual behaviour is each subfolder will contain all of it's files on a single drive.