rshell and wildcards

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
mc2software
Posts: 22
Joined: Wed Jan 13, 2021 6:08 pm
Location: Northern Florida

rshell and wildcards

Post by mc2software » Sat Jan 29, 2022 4:13 pm

I'm starting to use rshell after amp stopped working for some reason. I was using powershell scripts to copy the files via ampy but now am converting those scripts for rshell. My issue is that when I use a wildcard (*.py). If I use "cp *.py /pyboard/" I get "File....boot.py does'nt exist" for the source file. If I use "cp boot.py /pyboard/" it copies fine, as it does for each individual file. My unix experience is not as strong as my Windows.

ryanGT
Posts: 24
Joined: Fri Jan 28, 2022 12:15 am

Re: rshell and wildcards

Post by ryanGT » Sat Jan 29, 2022 8:40 pm

What happens if you put the part with the wild card in quotes: "*.py"?.

mc2software
Posts: 22
Joined: Wed Jan 13, 2021 6:08 pm
Location: Northern Florida

Re: rshell and wildcards

Post by mc2software » Sat Jan 29, 2022 8:54 pm

Code: Select all

cp "*.py" /pyboard/
gives me the same error.

I'm wondering if the long path is causing a problem. The full path is "/Users/MyUserName/OneDrive - mycompanyname, Inc/Development/Automation/Python Projects/ThisProject". I am not specifying the full path in the wildcard but I'm also not specifying it when I name the specific file. I'm running rshell by opening a prompt via the Shift-Right Click > open command window here, so rshell runs from the current directory.

Okay, so after typing that last paragraph, decided to test that idea.

This does not work if I'm running rshell from the current directory:

Code: Select all

cp "*.py" /pyboard/
But if I do this, it does work:

Code: Select all

cp  "/Users/MyUserName/OneDrive - mycompanyname, Inc/Development/Automation/Python Projects/This Project/*.py" /pyboard/
So I guess you have to be explicit in your folders and cannot assume that *.py will work for cp in the current folder, even though ls does. I have a solution.

ryanGT
Posts: 24
Joined: Fri Jan 28, 2022 12:15 am

Re: rshell and wildcards

Post by ryanGT » Sun Jan 30, 2022 1:55 am

That seems odd, but I'm glad you have something working. I don't love folders or filenames with spaces and commas, but if you are in the current folder, that shouldn't be an issue. I wonder if onedrive is doing something in the background to make the cloud folder appear local. But then why would the full path solve the issue. I don't know.

Post Reply