| <aid="copy_to_directory-name"></a>name | A unique name for this target. | <ahref="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <aid="copy_to_directory-exclude_prefixes"></a>exclude_prefixes | List of path prefixes to exclude from output directory.<br><br>If the output directory path for a file or directory starts with or is equal to a path in the list then that file is not copied to the output directory.<br><br>Exclude prefixes are matched *before* replace_prefixes are applied. | List of strings | optional | [] |
| <aid="copy_to_directory-include_external_repositories"></a>include_external_repositories | List of external repository names to include in the output directory.<br><br>Files from external repositories are not copied into the output directory unless the external repository they come from is listed here.<br><br>When copied from an external repository, the file path in the output directory defaults to the file's path within the external repository. The external repository name is _not_ included in that path.<br><br>For example, the following copies <code>@external_repo//path/to:file</code> to <code>path/to/file</code> within the output directory.<br><br><pre><code> copy_to_directory( name = "dir", include_external_repositories = ["external_repo"], srcs = ["@external_repo//path/to:file"], ) </code></pre><br><br>Files from external repositories are subject to <code>root_paths</code>, <code>exclude_prefixes</code> and <code>replace_prefixes</code> in the same way as files form the main repository. | List of strings | optional | [] |
| <aid="copy_to_directory-replace_prefixes"></a>replace_prefixes | Map of paths prefixes to replace in the output directory path when copying files.<br><br>If the output directory path for a file or directory starts with or is equal to a key in the dict then the matching portion of the output directory path is replaced with the dict value for that key.<br><br>Forward slashes (<code>/</code>) should be used as path separators. The final path segment of the key can be a partial match in the corresponding segment of the output directory path.<br><br>If there are multiple keys that match, the longest match wins. | <ahref="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {} |
| <aid="copy_to_directory-root_paths"></a>root_paths | List of paths that are roots in the output directory. If a file or directory being copied is in one of the listed paths or one of its subpaths, the output directory path is the path relative to the root path instead of the path relative to the file's workspace.<br><br>Forward slashes (<code>/</code>) should be used as path separators. Partial matches on the final path segment of a root path against the corresponding segment in the full workspace relative path of a file are not matched.<br><br>If there are multiple root paths that match, the longest match wins.<br><br>Defaults to [package_name()] so that the output directory path of files in the target's package and and sub-packages are relative to the target's package and files outside of that retain their full workspace relative paths. | List of strings | optional | [] |
| <aid="copy_to_directory-srcs"></a>srcs | Files and/or directories to copy into the output directory | <ahref="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |