Skip to content

put -r: say where the folder goes, and name a missing parent folder - #189

Merged
bdbarnett merged 3 commits into
mainfrom
fix/185-put-r
Oct 30, 2026
Merged

bdbarnett merged 3 commits into
mainfrom
fix/185-put-r

Conversation

@bdbarnett

Copy link
Copy Markdown
Collaborator

Part of #185.

put -r copies like cp -r: into a destination folder that already exists, the source folder goes inside it. That's unchanged here, but nothing said so, and re-uploading a library to the same path wrote a nested copy while the old files stayed where code imports them from.

  • put --help, the CLI reference and the file-transfer guide now say where the folder goes, and the guide shows how to update a folder already on the board (put -r ./cast /).
  • A destination whose parent folder doesn't exist failed with [Errno 2] /repro/cast/a.py, naming a file inside it. It now says can't create /repro/cast: the folder /repro isn't on the board (make it first: mpftp mkdir /repro), before writing anything.

Reproduced on an ESP32-P4 over USB: the first put into a missing /repro failed naming /repro/cast/a.py, and a second put -r new/cast /repro/cast wrote /repro/cast/cast/a.py. After the change the first names /repro, and put -r new/cast /repro replaced /repro/cast/a.py (read back as the new file). test_put.py has a test for the error that fails without the change.

A way to update a folder in place with the same destination path (a trailing slash, or a flag) would change what put -r does, so it isn't in this PR.

@bdbarnett
bdbarnett merged commit 32ecbe1 into main Oct 30, 2026
8 checks passed
@bdbarnett
bdbarnett deleted the fix/185-put-r branch October 30, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant