copy a file to multiple locations in linux

copy a file to multiple locations in linux

how to copy a file to multiple locations in linux. cp doesnt let you copy one file to multiple locations;
there are a few ways to do this, but the one I always return to uses find

to copy the contents of a directory to multiple other directories


find /location/to/folder -maxdepth 0 -type d -exec cp -r /location/to/other/folder/* {} \;

to copy a single file to multiple other directories


find /location/to/folder/file.txt -type f -exec cp -r /location/to/other/folder/ {} \;

to copy a directory and its content into another directory


find /location/to/folder -maxdepth 0 -type d -exec cp -r /location/to/other/folder/ {} \;

Tags for copy a file to multiple locations in linux

directory file folder linux location multiple