Reputation: 189
I'd imagine this would be a simply command, but I can't find a way to copy the contents of a directory to every subdirectory contained in a parent directory. For example, let's say I wanted to copy the path:
user/origin
to all of the following directories inside the destination "target" directory. For example...
user/target/1, user/target/6, user/target/2, user/target/a/10, etc.
Is there any way to achieve this functionality?
Upvotes: 0
Views: 38
Reputation:
Be careful because you can get an infinite loop, normally exec should suffice but when you are using recursion this way it causes an infinite loop so use xargs:
find user/target/ -type d | xargs -I {} cp -r user/origin {}
Upvotes: 1