I actually tried an existing answer from: How to copy a file to multiple folders using the command line? where I used the command:
find folder -exec cp file.txt {} \;
I wanted to use this because I wanted to copy one file named 'file.txt' to a directory named 'folder' and all its sub-directories without mentioning all the directories in the command.
However, what this ended up doing was replacing the contents of every file in 'folder' and its subfolders with the contents of 'file.txt'. For example, if there was a 'foo.txt' inside folder, it would still retain the name 'foo.txt' but all of its contents would be replaced by that of 'file.txt'. This perplexed me and I tried the following interactive flag:
find folder -exec cp -i file.txt {} \;
and I got overwrite prompts for every single file in the directory 'folder' and all of its sub-directories, even though the names were all different.
Can someone please help me figure out what's going on and what the appropriate command should be?