Perhaps I am mistaken, but I did not see a satisfactory answer for this question yet.
I have two directories which contain ~100 subdirectories. Within the directories, each subdirectory has the same name(s).
For example the first directory will have subdir1, subdir2, subdir3 and the second directory will have subdir1 subdir2, subdir3.
Within each subdirectory are files that need to all end up in one of the two subdirectories.
So basically I need a way of matching the identical subdirectory names and adding the files from one into the other. So that all the files from directory1/subdir1 and directory2/subdir1 end up in the same place.
There are too many files to make doing this manually very practical.
Any help would be much appreciated.
Why not just
cp -r source/ target/
Or, maybe
for name in subdir1 subdir2 subdir3; do cp -r */"$name"/; done
Add -v
to see what gets copied. -u
for "updates only"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With