tools/mpremote Copy folder content creates folder on board
Hi,
i noticed a behaviour with mpremote that doesn't seem right. I try to copy the content of a complete folder to the board. But instead of putting the folder content in the root of the device it creates a folder on the device and copies everything there.
Example:
Assume if have to following folder setup:
~/test$ tree mpy-project/
mpy-project/
├── boot.py
├── lib
│ └── urequests.py
└── main.py
I want to put the content of mpy-project on my empty board.
My first attempt was using this command:
mpremote connect /dev/ttyUSB1 cp -r mpy-project/* :
It transferred all files to the board but it was all in a folder called "mpy-project". It looked like that:
~/test$ mpytool -vp /dev/ttyUSB0 tree
./
└─ mpy-project/
├─ lib/
│ └─ urequests.py
├─ boot.py
└─ main.py
That seems counterintuitive for me since the *should be expanded and then the files should be copied.
There is also no use case where that behavior would make sense. If I wanted the complete folder copied I would leave /*out.
Or do i miss something?
Information about the version of MicroPython you're running
- Micropython 1.19.1
- mpremote 0.3.0
- ESP32
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