Copying from Pyboard to C drive with rshell

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
kbrenner
Posts: 46
Joined: Mon Jan 20, 2020 8:05 pm

Copying from Pyboard to C drive with rshell

Post by kbrenner » Wed Jan 05, 2022 7:59 pm

In the online tutorials, it is clear how to copy a file from the C drive to a Pyboard when using rshell:

cp main.py /pyboard/main.py

However, how do you go the opposite direction and copy a file from a Pyboard to the C drive? I have tried the following syntax but have been receiving the following error:

cp main.py /C:/Users/<username>/Documents/main.py

OSERror: [Errno 22] Invalid argument : '/C:/Users/<username>/Documents/main.py'

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Copying from Pyboard to C drive with rshell

Post by Roberthh » Thu Jan 06, 2022 12:13 pm

maybe:

cp /pyboard/main.py main.py

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Copying from Pyboard to C drive with rshell

Post by dhylands » Thu Jan 06, 2022 5:55 pm

Under windows, / will be the root of the current drive.

So you have 2 options. When you launch rshell, the current directory will be the directory that you were in when you launched. You could then use:

Code: Select all

cp /pyboard/main.py main.py
or if you had already changed the current directory to say /pyboard:

Code: Select all

cd /pyboard
cp main.py /Users/<username>/Documents/main.py
I don't think that rshell deals well with spaces in the filenames or directory names.

kbrenner
Posts: 46
Joined: Mon Jan 20, 2020 8:05 pm

Re: Copying from Pyboard to C drive with rshell

Post by kbrenner » Thu Jan 06, 2022 7:44 pm

dhylands wrote:
Thu Jan 06, 2022 5:55 pm
Under windows, / will be the root of the current drive.

So you have 2 options. When you launch rshell, the current directory will be the directory that you were in when you launched. You could then use:

Code: Select all

cp /pyboard/main.py main.py
or if you had already changed the current directory to say /pyboard:

Code: Select all

cd /pyboard
cp main.py /Users/<username>/Documents/main.py
I don't think that rshell deals well with spaces in the filenames or directory names.
Thanks, Dave. Your second option worked just fine. I think the issue was including the /C: prefix for the destination file location.

Post Reply