|Just another Perl shrine|
Unification of Directories (their contents)by PetaMem (Priest)
|on Apr 25, 2009 at 17:50 UTC||Need Help??|
PetaMem has asked for the
wisdom of the Perl Monks concerning the following question:
given n directories D1..Dn with arbitrary content. I would like a function that takes these source directories and copies their contents to a destination directory Dd such, that Dd is the union of all files and the fs structure of D1..Dn.
D1 - Folder1 - file1 - file2 - Folder2 - file4 D2 - Folder1 - file3 - file5 - Folder3 - file7 => Dd - Folder1 - file1 - file2 - file3 - file5 - Folder2 - file4 - Folder3 - file7
Right now, I can assume, that the sets of D1..Dn are mutually exclusive, but of course a hook on how to behave on clashes (and what type of clash .. name/diff) would not hurt.
Does such a thing already exist? I know about UnionFS, but rather than this transparent solution I would prefer a CLI-based batch processing tool, because these merging operations are one-shot only.
Maybe I should start to have LESS Perl on my mind... ;-)
Does the trick. Ok, it's not that portable, it's not perl, but for the moment...