Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Guest

Thank you Martin, it was that :oops:
martin

You need to escape the backslashes too, just as you did with path to WinSCP
system ("\"C:\\Program Files (x86)\\WinSCP\\WinSCP.exe\" /script=C:\\mydir\\Script\\global.txt /log=C:\\primarmi\\Log\\global_log.txt", $exitcode);
Spike00

Thank you Martin,
Now I obtain this error message:

Cannot open file C:\mydir\Script

without the filename totale.txt

I searched the forum, but didn't find another with the same problem, only a user who had encoding problem. About encoding, I use geany as text editor and my file is encoded with UTF-8

I'm sure the path is correct (just to avoid mismatches I copied the path from the error message and pasted on window and it was ok).

I'm using Version 4.3.7 Build 1679

Any hint?
martin

Re: Problem with php scripting

You should definitelly use winscp.com, not winscp.exe.
Spike00

Problem with php scripting

Hello, I wrote a php script to synchronize local dir with remote dir. The local dir is on a pc with xampp installed, so php is available just from localhost with the browser.

Environment is windows seven.

I'm quite sure that it was working, but unfortunately I had to stop the development for many days and now when I came back to it, it doesn't work.

Here is where it blocks:

system ("\"C:\\Program Files (x86)\\WinSCP\\WinSCP.exe\" /script=C:\mydir\Script\global.txt /log=C:\primarmi\Log\global_log.txt", $exitcode);

It returns 1 for exitcode, so according to https://winscp.net/eng/docs/guide_automation_advanced#external there was an error.

I put all those backslashes according to this: https://www.php.net/manual/en/function.system.php

my global.txt contains this:

option batch abort

option confirm off
open ftp://user:pass@host
synchronize local mylocalpath remotepath
exit


Tried to enable loggin, with no luck (or at least, nothing was logged. Is it possible that winscp neither started?)

Any hint on what to do?