Skip to content

Commit

Permalink
Tools files rm: Update usage with new excludes parameter (conan-io#3743)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
2 people authored and franramirez688 committed Jun 4, 2024
1 parent 4b530b0 commit b9fe686
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions reference/tools/files/basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,26 @@ Usage:
conan.tools.files.rm()
----------------------

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

.. autofunction:: rm
.. code-block:: python
:caption: *Remove all files finished in .tmp in build_folder and recursively*
from conan.tools.files import rm
Usage:
rm(self, "*.tmp", self.build_folder, recursive=True)
.. code-block:: python
:caption: *Remove all files from bin_folder, except for any finished by .dll*
from conan.tools.files import rm
rm(self, "*.tmp", self.build_folder, recursive=True)
rm(self, "*", self.bin_folder, recursive=False, excludes="*.dll")
.. currentmodule:: conan.tools.files.files
.. autofunction:: rm
conan.tools.files.mkdir()
Expand Down Expand Up @@ -306,7 +313,7 @@ For UNIX libraries starting with **lib**, like *libmath.a*, this tool will colle
library name **math**. Regarding symlinks, this tool will keep only the "most generic"
file among the resolved real file and all symlinks pointing to this real file. For example
among files below, this tool will select *libmath.dylib* file and therefore only append
*math* in the returned list:
*math* in the returned list:

.. code-block:: shell
Expand Down

0 comments on commit b9fe686

Please sign in to comment.