I have bunch of directories following this structure:
\directories\
|---\directory1\
| |---file1.txt
| |---file2.txt
|
|---\directory2\
| |---file1.txt
| |---file3.txt
|
|---\directory3\
| |---file4.txt
| |---file2.txt
I want to merge the directories and files so it ends up like this:
\directories\
|---\directory1\
| |---file1.txt
| |---file2.txt
|
|---\directory2\
| |---file1.txt
| |---file3.txt
|
|---\directory3\
| |---file4.txt
| |---file2.txt
|
|---\mergeddata\
| |---file1.txt (from dir1 and dir2)
| |---file2.txt (from dir1 and dir4)
| |---file3.txt (from dir2)
| |---file4.txt (from dir3)
I am awful with bash and been trying quite a few things but... not getting any good results.
Looking forward to some help!