I have tried to copy a file
test.txt to multiple directories with one command:
cp ~/test.txt ~/folder1 ~/folder2
But I didn't succeed. Is there a way to do that in one command so I can copy a file or even a folder to multiple directories?
The only bash command that I know which can copy/save to multiple destinations is
You can use it in your case as follows:
Another way to achieve a copy to multiple locations is the following command :
If dir1 or dir2 have sub-directories that you don't want the file copied into, add
tries to copy two files (
If you want to make multiple copies of the file
(...and be careful if you have spaces embedded in the file names, you'll need quoting).
To copy whole directories you have to use the
this will create
You can create a help script , or you can do it with
This will make each directory as an argument to the
After a long search this work like a Charm also !
This will copy file.txt to every directory in your current location in terminal.
This will copy a folder to every sub directory in your current location in terminal.
I share it hope it helps others too .