Page 1 of 1

Merge directories

Posted: Sat Oct 28, 2017 9:30 am
by JayB
Would be great to have a "Merge" command available, if you select two or more directories. This would then merge the contents of all those directories into a new directory that Nimble Commander creates beforehand, whereas the user needs to input the folder name. All duplicate files and duplicate subdirectories would remain where they are. (I assume that any subdirectory tree structures would need to remain intact, with additional files added to the corresponding relative path in the new merged-folder.)

Using the command with ALT would show "Destructive Merge" instead of "Merge", i.e. all remaining duplicate files and duplicate subdirectories would be deleted by way of deleting the parent directories selected for merging. Only the newly created merger-dir would remain.

NC would have to perform a quick hash check (CRC-32?), if files at the same relative location have the same filename. If the hash differs, it should add a number suffix to the filename as in Finder, i.e. 1, 2, … 10, 11, 12, and so on. There should probably also be a warning when merging large directories—"Do you really want to?"—, and NC may have to check read permissions beforehand and return an error without performing any operation, if one of the directories or its subdirectories is not read-accessible by current user.

I had the idea when looking at one of those old school file sharing distributions, with rar segments, but all of them zipped again, so if you unzip them, you'll get e.g. 7 directories, each with a rar segment in them, so it would be nice to just merge these unzipped directories with all those rar segments into one, to be then able to unrar the segments. There are probably scripts/CLIs to do that—don't know of any—, but it might generally be a nice feature to implement in NC.