We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error with v1.4
Hello,

I have the following Conan recipe

```
# cat conanfile.txt 

[requires]
bitprim-node-cint/0.10.0@bitprim/testing
[generators]
cmake
[options]
bitprim-node-cint:shared=True
bitprim-node-cint:currency=BCH
[imports]
bin, *.dll    -> .
lib, *.so    -> .
lib, *.dylib    -> .
``` 

When I execute: `conan install .` 
I get the following errors:

```
...
PROJECT: Generator txt created conanbuildinfo.txt
PROJECT: Generated conaninfo.txt
Traceback (most recent call last):
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/command.py", line 1182, in run
    method(args[0][1:])
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/command.py", line 325, in install
    install_folder=args.install_folder)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/conan_api.py", line 77, in wrapper
    return f(*args, **kwargs)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/conan_api.py", line 465, in install
    no_imports=no_imports)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/manager.py", line 344, in install
    run_imports(conanfile, install_folder, output)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/importer.py", line 82, in run_imports
    conanfile.imports()
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/loader_parse.py", line 184, in imports
    conan_file.copy(*import_params)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/importer.py", line 160, in __call__
    excludes=excludes, keep_path=keep_path)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/file_copier.py", line 83, in __call__
    self._link_folders(src, dst, link_folders)
  File "/home/fernando/.local/lib/python2.7/site-packages/conans/client/file_copier.py", line 149, in _link_folders
    os.symlink(link, dst_link)
OSError: [Errno 2] No such file or directory

ERROR: [Errno 2] No such file or directory
```

```
$ conan --version
Conan version 1.4.0

$ python --version
Python 2.7.15

$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 28 (Twenty Eight)
Release:	28
Codename:	TwentyEight

```

It works fine with Conan 1.3.3.

Thanks and regards,
Fernando.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conans/client/file_copier.py`
Content:
```
1 import os
2 import fnmatch
3 import shutil
4 from collections import defaultdict
5 
6 from conans import tools
7 
8 
9 def report_copied_files(copied, output):
10     ext_files = defaultdict(list)
11     for f in copied:
12         _, ext = os.path.splitext(f)
13         ext_files[ext].append(os.path.basename(f))
14 
15     if not ext_files:
16         return False
17 
18     for ext, files in ext_files.items():
19         files_str = (", ".join(files)) if len(files) < 5 else ""
20         file_or_files = "file" if len(files) == 1 else "files"
21         if not ext:
22             output.info("Copied %d %s: %s" % (len(files), file_or_files, files_str))
23         else:
24             output.info("Copied %d '%s' %s: %s" % (len(files), ext, file_or_files, files_str))
25     return True
26 
27 
28 class FileCopier(object):
29     """ main responsible of copying files from place to place:
30     package: build folder -> package folder
31     imports: package folder -> user folder
32     export: user folder -> store "export" folder
33     """
34     def __init__(self, root_source_folder, root_destination_folder, excluded=None):
35         """
36         Takes the base folders to copy resources src -> dst. These folders names
37         will not be used in the relative names while copying
38         param root_source_folder: The base folder to copy things from, typically the
39                                   store build folder
40         param root_destination_folder: The base folder to copy things to, typicall the
41                                        store package folder
42         """
43         self._base_src = root_source_folder
44         self._base_dst = root_destination_folder
45         self._copied = []
46         self._excluded = [root_destination_folder]
47         if excluded:
48             self._excluded.append(excluded)
49 
50     def report(self, output):
51         return report_copied_files(self._copied, output)
52 
53     def __call__(self, pattern, dst="", src="", keep_path=True, links=False, symlinks=None,
54                  excludes=None, ignore_case=False):
55         """
56         param pattern: an fnmatch file pattern of the files that should be copied. Eg. *.dll
57         param dst: the destination local folder, wrt to current conanfile dir, to which
58                    the files will be copied. Eg: "bin"
59         param src: the source folder in which those files will be searched. This folder
60                    will be stripped from the dst name. Eg.: lib/Debug/x86
61         param keep_path: False if you want the relative paths to be maintained from
62                          src to dst folders, or just drop. False is useful if you want
63                          to collect e.g. many *.libs among many dirs into a single
64                          lib dir
65         return: list of copied files
66         """
67         if symlinks is not None:
68             links = symlinks
69         # Check for ../ patterns and allow them
70         if pattern.startswith(".."):
71             rel_dir = os.path.abspath(os.path.join(self._base_src, pattern))
72             base_src = os.path.dirname(rel_dir)
73             pattern = os.path.basename(rel_dir)
74         else:
75             base_src = self._base_src
76 
77         src = os.path.join(base_src, src)
78         dst = os.path.join(self._base_dst, dst)
79 
80         files_to_copy, link_folders = self._filter_files(src, pattern, links, excludes,
81                                                          ignore_case)
82         copied_files = self._copy_files(files_to_copy, src, dst, keep_path, links)
83         self._link_folders(src, dst, link_folders)
84         self._copied.extend(files_to_copy)
85         return copied_files
86 
87     def _filter_files(self, src, pattern, links, excludes, ignore_case):
88 
89         """ return a list of the files matching the patterns
90         The list will be relative path names wrt to the root src folder
91         """
92         filenames = []
93         linked_folders = []
94         for root, subfolders, files in os.walk(src, followlinks=True):
95             if root in self._excluded:
96                 subfolders[:] = []
97                 continue
98 
99             if links and os.path.islink(root):
100                 linked_folders.append(os.path.relpath(root, src))
101                 subfolders[:] = []
102                 continue
103             basename = os.path.basename(root)
104             # Skip git or svn subfolders
105             if basename in [".git", ".svn"]:
106                 subfolders[:] = []
107                 continue
108             if basename == "test_package":  # DO NOT export test_package/build folder
109                 try:
110                     subfolders.remove("build")
111                 except:
112                     pass
113 
114             relative_path = os.path.relpath(root, src)
115             for f in files:
116                 relative_name = os.path.normpath(os.path.join(relative_path, f))
117                 filenames.append(relative_name)
118 
119         if ignore_case:
120             filenames = {f.lower(): f for f in filenames}
121             pattern = pattern.lower()
122 
123         files_to_copy = fnmatch.filter(filenames, pattern)
124         if excludes:
125             if not isinstance(excludes, (tuple, list)):
126                 excludes = (excludes, )
127             if ignore_case:
128                 excludes = [e.lower() for e in excludes]
129             for exclude in excludes:
130                 files_to_copy = [f for f in files_to_copy if not fnmatch.fnmatch(f, exclude)]
131 
132         if ignore_case:
133             files_to_copy = [filenames[f] for f in files_to_copy]
134 
135         return files_to_copy, linked_folders
136 
137     @staticmethod
138     def _link_folders(src, dst, linked_folders):
139         for linked_folder in linked_folders:
140             link = os.readlink(os.path.join(src, linked_folder))
141             dst_link = os.path.join(dst, linked_folder)
142             try:
143                 # Remove the previous symlink
144                 os.remove(dst_link)
145             except OSError:
146                 pass
147             # link is a string relative to linked_folder
148             # e.j: os.symlink("test/bar", "./foo/test_link") will create a link to foo/test/bar in ./foo/test_link
149             os.symlink(link, dst_link)
150         # Remove empty links
151         for linked_folder in linked_folders:
152             dst_link = os.path.join(dst, linked_folder)
153             abs_path = os.path.realpath(dst_link)
154             if not os.path.exists(abs_path):
155                 os.remove(dst_link)
156 
157     @staticmethod
158     def _copy_files(files, src, dst, keep_path, symlinks):
159         """ executes a multiple file copy from [(src_file, dst_file), (..)]
160         managing symlinks if necessary
161         """
162         copied_files = []
163         for filename in files:
164             abs_src_name = os.path.join(src, filename)
165             filename = filename if keep_path else os.path.basename(filename)
166             abs_dst_name = os.path.normpath(os.path.join(dst, filename))
167             try:
168                 os.makedirs(os.path.dirname(abs_dst_name))
169             except:
170                 pass
171             if symlinks and os.path.islink(abs_src_name):
172                 linkto = os.readlink(abs_src_name)  # @UndefinedVariable
173                 try:
174                     os.remove(abs_dst_name)
175                 except OSError:
176                     pass
177                 os.symlink(linkto, abs_dst_name)  # @UndefinedVariable
178             else:
179                 shutil.copy2(abs_src_name, abs_dst_name)
180             copied_files.append(abs_dst_name)
181         return copied_files
182
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conans/client/file_copier.py b/conans/client/file_copier.py
--- a/conans/client/file_copier.py
+++ b/conans/client/file_copier.py
@@ -3,7 +3,7 @@
 import shutil
 from collections import defaultdict
 
-from conans import tools
+from conans.util.files import mkdir
 
 
 def report_copied_files(copied, output):
@@ -146,6 +146,7 @@
                 pass
             # link is a string relative to linked_folder
             # e.j: os.symlink("test/bar", "./foo/test_link") will create a link to foo/test/bar in ./foo/test_link
+            mkdir(os.path.dirname(dst_link))
             os.symlink(link, dst_link)
         # Remove empty links
         for linked_folder in linked_folders:

{"golden_diff": "diff --git a/conans/client/file_copier.py b/conans/client/file_copier.py\n--- a/conans/client/file_copier.py\n+++ b/conans/client/file_copier.py\n@@ -3,7 +3,7 @@\n import shutil\n from collections import defaultdict\n \n-from conans import tools\n+from conans.util.files import mkdir\n \n \n def report_copied_files(copied, output):\n@@ -146,6 +146,7 @@\n                 pass\n             # link is a string relative to linked_folder\n             # e.j: os.symlink(\"test/bar\", \"./foo/test_link\") will create a link to foo/test/bar in ./foo/test_link\n+            mkdir(os.path.dirname(dst_link))\n             os.symlink(link, dst_link)\n         # Remove empty links\n         for linked_folder in linked_folders:\n", "issue": "Error with v1.4\nHello,\r\n\r\nI have the following Conan recipe\r\n\r\n```\r\n# cat conanfile.txt \r\n\r\n[requires]\r\nbitprim-node-cint/0.10.0@bitprim/testing\r\n[generators]\r\ncmake\r\n[options]\r\nbitprim-node-cint:shared=True\r\nbitprim-node-cint:currency=BCH\r\n[imports]\r\nbin, *.dll    -> .\r\nlib, *.so    -> .\r\nlib, *.dylib    -> .\r\n``` \r\n\r\nWhen I execute: `conan install .` \r\nI get the following errors:\r\n\r\n```\r\n...\r\nPROJECT: Generator txt created conanbuildinfo.txt\r\nPROJECT: Generated conaninfo.txt\r\nTraceback (most recent call last):\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/command.py\", line 1182, in run\r\n    method(args[0][1:])\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/command.py\", line 325, in install\r\n    install_folder=args.install_folder)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/conan_api.py\", line 77, in wrapper\r\n    return f(*args, **kwargs)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/conan_api.py\", line 465, in install\r\n    no_imports=no_imports)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/manager.py\", line 344, in install\r\n    run_imports(conanfile, install_folder, output)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/importer.py\", line 82, in run_imports\r\n    conanfile.imports()\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/loader_parse.py\", line 184, in imports\r\n    conan_file.copy(*import_params)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/importer.py\", line 160, in __call__\r\n    excludes=excludes, keep_path=keep_path)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/file_copier.py\", line 83, in __call__\r\n    self._link_folders(src, dst, link_folders)\r\n  File \"/home/fernando/.local/lib/python2.7/site-packages/conans/client/file_copier.py\", line 149, in _link_folders\r\n    os.symlink(link, dst_link)\r\nOSError: [Errno 2] No such file or directory\r\n\r\nERROR: [Errno 2] No such file or directory\r\n```\r\n\r\n```\r\n$ conan --version\r\nConan version 1.4.0\r\n\r\n$ python --version\r\nPython 2.7.15\r\n\r\n$ lsb_release -a\r\nLSB Version:\t:core-4.1-amd64:core-4.1-noarch\r\nDistributor ID:\tFedora\r\nDescription:\tFedora release 28 (Twenty Eight)\r\nRelease:\t28\r\nCodename:\tTwentyEight\r\n\r\n```\r\n\r\nIt works fine with Conan 1.3.3.\r\n\r\nThanks and regards,\r\nFernando.\n", "before_files": [{"content": "import os\nimport fnmatch\nimport shutil\nfrom collections import defaultdict\n\nfrom conans import tools\n\n\ndef report_copied_files(copied, output):\n    ext_files = defaultdict(list)\n    for f in copied:\n        _, ext = os.path.splitext(f)\n        ext_files[ext].append(os.path.basename(f))\n\n    if not ext_files:\n        return False\n\n    for ext, files in ext_files.items():\n        files_str = (\", \".join(files)) if len(files) < 5 else \"\"\n        file_or_files = \"file\" if len(files) == 1 else \"files\"\n        if not ext:\n            output.info(\"Copied %d %s: %s\" % (len(files), file_or_files, files_str))\n        else:\n            output.info(\"Copied %d '%s' %s: %s\" % (len(files), ext, file_or_files, files_str))\n    return True\n\n\nclass FileCopier(object):\n    \"\"\" main responsible of copying files from place to place:\n    package: build folder -> package folder\n    imports: package folder -> user folder\n    export: user folder -> store \"export\" folder\n    \"\"\"\n    def __init__(self, root_source_folder, root_destination_folder, excluded=None):\n        \"\"\"\n        Takes the base folders to copy resources src -> dst. These folders names\n        will not be used in the relative names while copying\n        param root_source_folder: The base folder to copy things from, typically the\n                                  store build folder\n        param root_destination_folder: The base folder to copy things to, typicall the\n                                       store package folder\n        \"\"\"\n        self._base_src = root_source_folder\n        self._base_dst = root_destination_folder\n        self._copied = []\n        self._excluded = [root_destination_folder]\n        if excluded:\n            self._excluded.append(excluded)\n\n    def report(self, output):\n        return report_copied_files(self._copied, output)\n\n    def __call__(self, pattern, dst=\"\", src=\"\", keep_path=True, links=False, symlinks=None,\n                 excludes=None, ignore_case=False):\n        \"\"\"\n        param pattern: an fnmatch file pattern of the files that should be copied. Eg. *.dll\n        param dst: the destination local folder, wrt to current conanfile dir, to which\n                   the files will be copied. Eg: \"bin\"\n        param src: the source folder in which those files will be searched. This folder\n                   will be stripped from the dst name. Eg.: lib/Debug/x86\n        param keep_path: False if you want the relative paths to be maintained from\n                         src to dst folders, or just drop. False is useful if you want\n                         to collect e.g. many *.libs among many dirs into a single\n                         lib dir\n        return: list of copied files\n        \"\"\"\n        if symlinks is not None:\n            links = symlinks\n        # Check for ../ patterns and allow them\n        if pattern.startswith(\"..\"):\n            rel_dir = os.path.abspath(os.path.join(self._base_src, pattern))\n            base_src = os.path.dirname(rel_dir)\n            pattern = os.path.basename(rel_dir)\n        else:\n            base_src = self._base_src\n\n        src = os.path.join(base_src, src)\n        dst = os.path.join(self._base_dst, dst)\n\n        files_to_copy, link_folders = self._filter_files(src, pattern, links, excludes,\n                                                         ignore_case)\n        copied_files = self._copy_files(files_to_copy, src, dst, keep_path, links)\n        self._link_folders(src, dst, link_folders)\n        self._copied.extend(files_to_copy)\n        return copied_files\n\n    def _filter_files(self, src, pattern, links, excludes, ignore_case):\n\n        \"\"\" return a list of the files matching the patterns\n        The list will be relative path names wrt to the root src folder\n        \"\"\"\n        filenames = []\n        linked_folders = []\n        for root, subfolders, files in os.walk(src, followlinks=True):\n            if root in self._excluded:\n                subfolders[:] = []\n                continue\n\n            if links and os.path.islink(root):\n                linked_folders.append(os.path.relpath(root, src))\n                subfolders[:] = []\n                continue\n            basename = os.path.basename(root)\n            # Skip git or svn subfolders\n            if basename in [\".git\", \".svn\"]:\n                subfolders[:] = []\n                continue\n            if basename == \"test_package\":  # DO NOT export test_package/build folder\n                try:\n                    subfolders.remove(\"build\")\n                except:\n                    pass\n\n            relative_path = os.path.relpath(root, src)\n            for f in files:\n                relative_name = os.path.normpath(os.path.join(relative_path, f))\n                filenames.append(relative_name)\n\n        if ignore_case:\n            filenames = {f.lower(): f for f in filenames}\n            pattern = pattern.lower()\n\n        files_to_copy = fnmatch.filter(filenames, pattern)\n        if excludes:\n            if not isinstance(excludes, (tuple, list)):\n                excludes = (excludes, )\n            if ignore_case:\n                excludes = [e.lower() for e in excludes]\n            for exclude in excludes:\n                files_to_copy = [f for f in files_to_copy if not fnmatch.fnmatch(f, exclude)]\n\n        if ignore_case:\n            files_to_copy = [filenames[f] for f in files_to_copy]\n\n        return files_to_copy, linked_folders\n\n    @staticmethod\n    def _link_folders(src, dst, linked_folders):\n        for linked_folder in linked_folders:\n            link = os.readlink(os.path.join(src, linked_folder))\n            dst_link = os.path.join(dst, linked_folder)\n            try:\n                # Remove the previous symlink\n                os.remove(dst_link)\n            except OSError:\n                pass\n            # link is a string relative to linked_folder\n            # e.j: os.symlink(\"test/bar\", \"./foo/test_link\") will create a link to foo/test/bar in ./foo/test_link\n            os.symlink(link, dst_link)\n        # Remove empty links\n        for linked_folder in linked_folders:\n            dst_link = os.path.join(dst, linked_folder)\n            abs_path = os.path.realpath(dst_link)\n            if not os.path.exists(abs_path):\n                os.remove(dst_link)\n\n    @staticmethod\n    def _copy_files(files, src, dst, keep_path, symlinks):\n        \"\"\" executes a multiple file copy from [(src_file, dst_file), (..)]\n        managing symlinks if necessary\n        \"\"\"\n        copied_files = []\n        for filename in files:\n            abs_src_name = os.path.join(src, filename)\n            filename = filename if keep_path else os.path.basename(filename)\n            abs_dst_name = os.path.normpath(os.path.join(dst, filename))\n            try:\n                os.makedirs(os.path.dirname(abs_dst_name))\n            except:\n                pass\n            if symlinks and os.path.islink(abs_src_name):\n                linkto = os.readlink(abs_src_name)  # @UndefinedVariable\n                try:\n                    os.remove(abs_dst_name)\n                except OSError:\n                    pass\n                os.symlink(linkto, abs_dst_name)  # @UndefinedVariable\n            else:\n                shutil.copy2(abs_src_name, abs_dst_name)\n            copied_files.append(abs_dst_name)\n        return copied_files\n", "path": "conans/client/file_copier.py"}], "after_files": [{"content": "import os\nimport fnmatch\nimport shutil\nfrom collections import defaultdict\n\nfrom conans.util.files import mkdir\n\n\ndef report_copied_files(copied, output):\n    ext_files = defaultdict(list)\n    for f in copied:\n        _, ext = os.path.splitext(f)\n        ext_files[ext].append(os.path.basename(f))\n\n    if not ext_files:\n        return False\n\n    for ext, files in ext_files.items():\n        files_str = (\", \".join(files)) if len(files) < 5 else \"\"\n        file_or_files = \"file\" if len(files) == 1 else \"files\"\n        if not ext:\n            output.info(\"Copied %d %s: %s\" % (len(files), file_or_files, files_str))\n        else:\n            output.info(\"Copied %d '%s' %s: %s\" % (len(files), ext, file_or_files, files_str))\n    return True\n\n\nclass FileCopier(object):\n    \"\"\" main responsible of copying files from place to place:\n    package: build folder -> package folder\n    imports: package folder -> user folder\n    export: user folder -> store \"export\" folder\n    \"\"\"\n    def __init__(self, root_source_folder, root_destination_folder, excluded=None):\n        \"\"\"\n        Takes the base folders to copy resources src -> dst. These folders names\n        will not be used in the relative names while copying\n        param root_source_folder: The base folder to copy things from, typically the\n                                  store build folder\n        param root_destination_folder: The base folder to copy things to, typicall the\n                                       store package folder\n        \"\"\"\n        self._base_src = root_source_folder\n        self._base_dst = root_destination_folder\n        self._copied = []\n        self._excluded = [root_destination_folder]\n        if excluded:\n            self._excluded.append(excluded)\n\n    def report(self, output):\n        return report_copied_files(self._copied, output)\n\n    def __call__(self, pattern, dst=\"\", src=\"\", keep_path=True, links=False, symlinks=None,\n                 excludes=None, ignore_case=False):\n        \"\"\"\n        param pattern: an fnmatch file pattern of the files that should be copied. Eg. *.dll\n        param dst: the destination local folder, wrt to current conanfile dir, to which\n                   the files will be copied. Eg: \"bin\"\n        param src: the source folder in which those files will be searched. This folder\n                   will be stripped from the dst name. Eg.: lib/Debug/x86\n        param keep_path: False if you want the relative paths to be maintained from\n                         src to dst folders, or just drop. False is useful if you want\n                         to collect e.g. many *.libs among many dirs into a single\n                         lib dir\n        return: list of copied files\n        \"\"\"\n        if symlinks is not None:\n            links = symlinks\n        # Check for ../ patterns and allow them\n        if pattern.startswith(\"..\"):\n            rel_dir = os.path.abspath(os.path.join(self._base_src, pattern))\n            base_src = os.path.dirname(rel_dir)\n            pattern = os.path.basename(rel_dir)\n        else:\n            base_src = self._base_src\n\n        src = os.path.join(base_src, src)\n        dst = os.path.join(self._base_dst, dst)\n\n        files_to_copy, link_folders = self._filter_files(src, pattern, links, excludes,\n                                                         ignore_case)\n        copied_files = self._copy_files(files_to_copy, src, dst, keep_path, links)\n        self._link_folders(src, dst, link_folders)\n        self._copied.extend(files_to_copy)\n        return copied_files\n\n    def _filter_files(self, src, pattern, links, excludes, ignore_case):\n\n        \"\"\" return a list of the files matching the patterns\n        The list will be relative path names wrt to the root src folder\n        \"\"\"\n        filenames = []\n        linked_folders = []\n        for root, subfolders, files in os.walk(src, followlinks=True):\n            if root in self._excluded:\n                subfolders[:] = []\n                continue\n\n            if links and os.path.islink(root):\n                linked_folders.append(os.path.relpath(root, src))\n                subfolders[:] = []\n                continue\n            basename = os.path.basename(root)\n            # Skip git or svn subfolders\n            if basename in [\".git\", \".svn\"]:\n                subfolders[:] = []\n                continue\n            if basename == \"test_package\":  # DO NOT export test_package/build folder\n                try:\n                    subfolders.remove(\"build\")\n                except:\n                    pass\n\n            relative_path = os.path.relpath(root, src)\n            for f in files:\n                relative_name = os.path.normpath(os.path.join(relative_path, f))\n                filenames.append(relative_name)\n\n        if ignore_case:\n            filenames = {f.lower(): f for f in filenames}\n            pattern = pattern.lower()\n\n        files_to_copy = fnmatch.filter(filenames, pattern)\n        if excludes:\n            if not isinstance(excludes, (tuple, list)):\n                excludes = (excludes, )\n            if ignore_case:\n                excludes = [e.lower() for e in excludes]\n            for exclude in excludes:\n                files_to_copy = [f for f in files_to_copy if not fnmatch.fnmatch(f, exclude)]\n\n        if ignore_case:\n            files_to_copy = [filenames[f] for f in files_to_copy]\n\n        return files_to_copy, linked_folders\n\n    @staticmethod\n    def _link_folders(src, dst, linked_folders):\n        for linked_folder in linked_folders:\n            link = os.readlink(os.path.join(src, linked_folder))\n            dst_link = os.path.join(dst, linked_folder)\n            try:\n                # Remove the previous symlink\n                os.remove(dst_link)\n            except OSError:\n                pass\n            # link is a string relative to linked_folder\n            # e.j: os.symlink(\"test/bar\", \"./foo/test_link\") will create a link to foo/test/bar in ./foo/test_link\n            mkdir(os.path.dirname(dst_link))\n            os.symlink(link, dst_link)\n        # Remove empty links\n        for linked_folder in linked_folders:\n            dst_link = os.path.join(dst, linked_folder)\n            abs_path = os.path.realpath(dst_link)\n            if not os.path.exists(abs_path):\n                os.remove(dst_link)\n\n    @staticmethod\n    def _copy_files(files, src, dst, keep_path, symlinks):\n        \"\"\" executes a multiple file copy from [(src_file, dst_file), (..)]\n        managing symlinks if necessary\n        \"\"\"\n        copied_files = []\n        for filename in files:\n            abs_src_name = os.path.join(src, filename)\n            filename = filename if keep_path else os.path.basename(filename)\n            abs_dst_name = os.path.normpath(os.path.join(dst, filename))\n            try:\n                os.makedirs(os.path.dirname(abs_dst_name))\n            except:\n                pass\n            if symlinks and os.path.islink(abs_src_name):\n                linkto = os.readlink(abs_src_name)  # @UndefinedVariable\n                try:\n                    os.remove(abs_dst_name)\n                except OSError:\n                    pass\n                os.symlink(linkto, abs_dst_name)  # @UndefinedVariable\n            else:\n                shutil.copy2(abs_src_name, abs_dst_name)\n            copied_files.append(abs_dst_name)\n        return copied_files\n", "path": "conans/client/file_copier.py"}]}