[Centos] How to cp a file to every subdirectory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Mike Kercher wrote:
> I need to copy a file (or actually a symlink) to every subdirectory on a
> path.
> 
> I know that cp -s will do the copy I want, but how can I get it to go into
> every subdirectory?  I've tried different iterations of ls to get a listing
> of directories only (recursively) without success.
> 
> TIA
> 
> Mike

find <directory> -type d -exec echo cp <file> "{}" \;

Remove the echo to do it for real.

-Mike

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux