Skip to content

Commit b9fe686

Browse files
uilianriesczoido
authored andcommitted
Tools files rm: Update usage with new excludes parameter (conan-io#3743)
* Update rm tool with usage Signed-off-by: Uilian Ries <uilianries@gmail.com> * Use basic rm for basic example. Co-authored-by: Carlos Zoido <mrgalleta@gmail.com> --------- Signed-off-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
1 parent 4b530b0 commit b9fe686

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

reference/tools/files/basic.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,26 @@ Usage:
106106
conan.tools.files.rm()
107107
----------------------
108108

109-
.. currentmodule:: conan.tools.files.files
109+
This function removes files from the filesystem. It can be used to remove a single file or a pattern based on fnmatch.
110+
It's indicated to use it instead of ``os.remove`` because it's cross-platform and may avoid permissions issues.
110111

111-
.. autofunction:: rm
112+
.. code-block:: python
113+
:caption: *Remove all files finished in .tmp in build_folder and recursively*
112114
115+
from conan.tools.files import rm
113116
114-
Usage:
117+
rm(self, "*.tmp", self.build_folder, recursive=True)
115118
116119
.. code-block:: python
120+
:caption: *Remove all files from bin_folder, except for any finished by .dll*
117121
118122
from conan.tools.files import rm
119123
120-
rm(self, "*.tmp", self.build_folder, recursive=True)
124+
rm(self, "*", self.bin_folder, recursive=False, excludes="*.dll")
121125
126+
.. currentmodule:: conan.tools.files.files
127+
128+
.. autofunction:: rm
122129
123130
124131
conan.tools.files.mkdir()
@@ -306,7 +313,7 @@ For UNIX libraries starting with **lib**, like *libmath.a*, this tool will colle
306313
library name **math**. Regarding symlinks, this tool will keep only the "most generic"
307314
file among the resolved real file and all symlinks pointing to this real file. For example
308315
among files below, this tool will select *libmath.dylib* file and therefore only append
309-
*math* in the returned list:
316+
*math* in the returned list:
310317

311318
.. code-block:: shell
312319

0 commit comments

Comments
 (0)