mpremote: Behaviour is confusing with multiple mountpoints
Description
Follow on from https://github.com/micropython/micropython/pull/11777#issuecomment-2390338451.
To the naive user of a system with multiple mounted filesystems the behaviour of
$ mpremote cp foo.py :
seems nondeterministic, because the destination of the copy can only be established with knowledge of the state of the target (its current directory). The same applies to
$ mpremote ls :
The following change would provide a deterministic and more discoverable interface.
- Where there is only one mounted filesystem, behaviour remains exactly as currently.
- Where there are multiple filesystems behaviour is as follows:
mpremote ls : produces a list of mountpoints (as per ls : /).
mpremote cp foo.py : throws an exception because you cannot write to '/'.
mpremote cp foo.py :/sd/ works as at present.
While this is a breaking change, an inability to write to '/' will not surprise anyone familiar with the MP directory structure.
Code Size
No response
Implementation
I hope the MicroPython maintainers or community will implement this feature
Code of Conduct
Yes, I agree
mpremote cp -r command fails with "mpremote: cp: -r not specified; omitting directory"
Port, board and/or hardware
ESP32 on a custom designed ESP32-s3 board
MicroPython version
MicroPython v1.25.0 on 2025-04-15; Generic ESP32S3 module with ESP32S3
Reproduction
- install mpremote using the instructions here.
- run the command
mpremote connect /dev/cu.usbserial-A5069RR4 cp -r configuration/ :configuration/to recursively copy theconfigurationdirectory to the board.
Expected behaviour
I expected the command to recursively copy all files within the configuration directory over to the board to a folder located at /configuration, and to create that folder if it doesn't exist. This expectation comes from the documentation on this page.
mpremote cp -r utils/ :utils/ + soft-reset repl
Same as above, but update the entire utils directory first.
Observed behaviour
The tool returns the following error:
$ mpremote connect /dev/cu.usbserial-A5069RR4 cp -r configuration/ :configuration/
cp configuration/ :configuration/
mpremote: cp: -r not specified; omitting directory
Additional Information
Running on a M1 MacBook Pro, macOS Sequoia 15.3.2.
Using mpremote 1.25.0.
Code of Conduct
Yes, I agree