Remote Server Path Separator Character

Advertisement

aksarben
Joined:
Posts:
68

Remote Server Path Separator Character

Is there an easy way for a script to determine the path separator character used by the remote server (e.g., / vs. \)?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,733
Location:
Prague, Czechia

Re: Remote Server Path Separator Character

Can you be more specific about the problem you are trying to solve?
WinSCP scripting always uses the forward slash – / – for the remote paths.

Reply with quote

aksarben
Joined:
Posts:
68

Re: Remote Server Path Separator Character

To be honest, it’s been so long I forgot I had submitted this.

My Web hosting company recently moved my site from an old Microsoft IIS server to a Linux server. So the upload script I had been using broke because it assumed the path separator character was always a backslash (used on Windows). I was trying to figure out a simple way to determine when we should convert paths of the Windows files to upload so they used the separator character expected by the server.

I finally took the easy way out and just always assumed the separator character should be a forward slash, and added a line to the PowerShell script that always replaces back slashes with forward slashes. If I ever get moved back to a Windows server, I'll store the server’s expected separator character in the registry & read it when needed. If I live that long…

Sorry for the trouble. If I had remembered this post I would have closed it a long time ago.

Reply with quote

martin
Site Admin
martin avatar

Re: Remote Server Path Separator Character

You have posted it two days ago only!?!

And again, you can always use forward slash.

Reply with quote

Advertisement

You can post new topics in this forum