@@ -229,7 +229,7 @@ The full list of supported commands are:
229229 - ``ls `` to list the current directory
230230 - ``ls <dirs...> `` to list the given directories
231231 - ``cp [-rf] <src...> <dest> `` to copy files
232- - ``rm <src...> `` to remove files on the device
232+ - ``rm [-r] <src...> `` to remove files or folders on the device
233233 - ``mkdir <dirs...> `` to create directories on the device
234234 - ``rmdir <dirs...> `` to remove directories on the device
235235 - ``touch <file..> `` to create the files (if they don't already exist)
@@ -238,15 +238,35 @@ The full list of supported commands are:
238238 The ``cp `` command uses a convention where a leading ``: `` represents a remote
239239 path. Without a leading ``: `` means a local path. This is based on the
240240 convention used by the `Secure Copy Protocol (scp) client
241- <https://en.wikipedia.org/wiki/Secure_copy_protocol> `_. All other commands
242- implicitly assume the path is a remote path, but the ``: `` can be optionally
243- used for clarity.
241+ <https://en.wikipedia.org/wiki/Secure_copy_protocol> `_.
244242
245243 So for example, ``mpremote fs cp main.py :main.py `` copies ``main.py `` from
246244 the current local directory to the remote filesystem, whereas
247245 ``mpremote fs cp :main.py main.py `` copies ``main.py `` from the device back
248246 to the current directory.
249247
248+ The ``mpremote rm -r `` command accepts both relative and absolute paths.
249+ Use ``: `` to refer to the current remote working directory (cwd) to allow a
250+ directory tree to be removed from the device's default path (eg ``/flash ``, ``/ ``).
251+ Use ``-v/--verbose `` to see the files being removed.
252+
253+ For example:
254+
255+ - ``mpremote rm -r :libs `` will remove the ``libs `` directory and all its
256+ child items from the device.
257+ - ``mpremote rm -rv :/sd `` will remove all files from a mounted SDCard and result
258+ in a non-blocking warning. The mount will be retained.
259+ - ``mpremote rm -rv :/ `` will remove all files on the device, including any
260+ located in mounted vfs such as ``/sd `` or ``/flash ``. After removing all folders
261+ and files, this will also return an error to mimic unix ``rm -rf / `` behaviour.
262+
263+ .. warning ::
264+ There is no supported way to undelete files removed by ``mpremote rm -r : ``.
265+ Please use with caution.
266+
267+ All other commands implicitly assume the path is a remote path, but the ``: ``
268+ can be optionally used for clarity.
269+
250270 All of the filesystem sub-commands take multiple path arguments, so if there
251271 is another command in the sequence, you must use ``+ `` to terminate the
252272 arguments, e.g.
0 commit comments