// Local path to download to (keep trailing slash) var LOCALPATH = "c:\\sftptest\\"; // Remote path to search in (keep trailing slash) var REMOTEPATH = "/in/"; // Mask of files to search for var FILEMASK = "*.*"; // Session to connect to var SESSION = "firstname.lastname@example.org"; // Path to winscp.com var WINSCP = "c:\\program files (x86)\\winscp\\winscp.com";
I left everything else exactly the same.
I saved the file as sftp.js and put it both in the winscp program folder and on in the current directory on the sftp site. Then I opened my session in winscp, opened console and typed:
cscript /nologo sftp.js
I get an error "Command 'cscript /nologo sftp.js' failed with return code 127 and error message -bash: line 11: cscript:command not found.
What I am trying to do is to download the most recent file on the server, ultimately I want to create a batch file to do all this. I need a step-by-step guide please!