mpremote fs cp can only handle files that already exist
Port, board and/or hardware
Custom RP2040 Pi Pico clone running MicroPython 9.2.8
MicroPython version
Adafruit CircuitPython 9.2.8 on 2025-05-28; Raspberry Pi Pico with rp2040
Reproduction
I'm trying to copy source files to my board, but it fails if a file with the same name doesn't already exist:
mpremote connect id:E464D431C33D2021 fs cp communication.py :
cp communication.py :
mpremote: Error with transport:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file/directory: ./communication.py
But if I first create the file...
Adafruit CircuitPython 9.2.8 on 2025-05-28; Raspberry Pi Pico with rp2040
>>> file = open("/communication.py", "w")
>>> file.write("Hello world!")
12
>>> file.close()
>>> file = open("/communication.py")
>>> print(file.readline())
Hello world!
>>> file.close()
... the cp command works perfectly and does what it is supposed to do.
mpremote connect id:E464D431C33D2021 fs cp communication.py :communication.py
cp communication.py :communication.py
[Shows copy progress and finishes without error]
I have also tried to omit the target file name like mpremote connect id:E464D431C33D2021 fs cp communication.py : but it makes no difference.
Expected behaviour
I expect the cp command to create the file on the target board if it doesn't already exist
Observed behaviour
The cp command fails complaining that the file can't be found. I know that, that's why I want to copy it to the unit.
Additional Information
mpremote --version
mpremote 1.25.0
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