0

I've been having lots of troubles using pscp and regex on AIX server.

As you can see, I am trying to use Putty's pscp to transfer file "stdout" to my local folder.

This usually works fine, but my problem is that I won't know exact same folder name so I need to use REGEX.

I've been told that possibly my regex was written for grep and that it wasn't supported by pscp.

What would be alternative then to write regex for pscp.

Error message is: "multiple-level wildcards unsupported"

pscp.exe -P 22 -pw krt_345 testuser@testserver5:"/app/log/s500/20201023/.\*/20201023-02\.2[0-9]\.[0-5][0-9]_s500_testuser.\*"/stdout C:\logs

regex only:

"/app/log/s500/20201023/.\*/20201023-02\.2[0-9]\.[0-5][0-9]_s500_testuser.\*"/stdout
whatismyname123
  • 149
  • 1
  • 13

1 Answers1

1

With SCP protocol, the filemask in the path is resolved by the server. With a typical OpenSSH scp "server", you can use standard Linux glob masks. Definitely not regex. Though your mask is simple enough, that a simple glob mask 20201023-02.2[0-9].[0-5][0-9]_s500_testuser* would. But you can use glob mask for the last path component only. Not for the parent directory. What is what the "multiple-level wildcards unsupported" error message is trying to tell you.

So what you are doing is not doable with SCP. You would have to obtain the folder name using other means. Like using a shell commands over SSH.

And I belive you have asked for this already:
Finding folder name on a server using batch file
And based on your comments to the answer, you already know what you need to combine a shell command like find with scp. So I do not understand, why don't you ask for that.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • I appreciate feedback. Thank you for explaining this to me. find . -type d -regextype sed -regex ".*/20201020-17\.5[0-9]\.[0-5][0-9]_r52d4.*" - this answer doesn't work on aix server, "Invalid regular expression type: sed" I have to figure it out. – whatismyname123 Oct 26 '20 at 11:18
  • You do not need regex, you can do with a simple glob mask: `find ./ -type d -name "20201020-17.5[0-9].[0-5][0-9]_r52d4*"` – Martin Prikryl Oct 26 '20 at 12:24