# Is there a way to symbolically link files from one directory and it's subdirectories into another directory

Currently I have:

class symboliclink::symlinker ($link_to_targets ) {$link_to_targets.each |String $link_to, String$target| {
#file { "setuplink-$target": file { "$target":
#path   => $target, ensure => link, target =>$link_to,
force   => yes,
recurse => true,
}
}
}


But this gives me the error:

Failed to generate additional resources using 'eval_generate': Too many levels of symbolic links @ rb_file_s_stat - /dts/env/ATEST06/tomcat-instance/logs/catalina.2017-12-18.log


Normally I would go to the directory where I want to create the links and run the command:

ln -s /opt/openerp/web/addons/*


Also, is there a way I can do this to multiple subdirectories? I do NOT want to copy the files over.

What is the value of $link_to_targets? What do you expect to be the resulting file resources then? What shall link to what according to your understanding? Can't you just link the whole directory, or do you _have_ to link individual files? How 'bout a bind mount? I'm just spitballing here. ( 2018-01-06 23:41:20 -0600 )edit Yes create symbolic link for files while sybmboilic link to any sub directory is fine because any files in the subdirectory will then anyways be accessible. link_to targets is a : delimited row providing the$link_to (source) basically on LHS while the \$target on RHS.