GET to copy wildcard files works from linux to windows, but not PUT (wildcard) from Windows to Linux

Advertisement

fil
Guest

GET to copy wildcard files works from linux to windows, but not PUT (wildcard) from Windows to Linux

Text file is below. Am trying to run Winscp as a scheduled task, reading the text file to do it's job. The 'get' command properly copies a file, but the 'put' command does not. Using the WinSCP gui though, works fine to both upload and download between the two servers.

option batch abort
option confirm off
get /salesforce/linux_to_win/*.* R:\linux_to_win\
put R:\Win_to_linux\*.* /salesforce/Win_to_linux/
exit

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: GET to copy wildcard files works from linux to windows, but not PUT (wildcard) from Windows to Linux

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Guest

Re: GET to copy wildcard files works from linux to windows, but not PUT (wildcard) from Windows to Linux

Now it's a mess. I neglected to say that we saved a WinSCP connection (to our Linux server) shortcut to the desktop. So I am running the script mentioned above with the command found on the 'Target' box of the Windows shortcut. So that command is: "C:\Program Files (x86)\WinSCP\WinSCP.exe" "%2Fsalesforce%2Fsysadmin%40MyLinuxServer" /Desktop /UploadIfAny (its also shown in the log file)

When I was running this under a regular command prompt, the log you showed how to create was showing an error 5 'Access is Denied' to the local drive on the windows server (R:\Linux It would also return to a command line prompt. NOW, however, after upgrading Winscp from 5.9.5 to 5.9.6, it seems to not go back to a command prompt, but wait for a username. (my username is already being supplied as 'sysadmin' as seen in mycommand line)

For my privacy, from the log I removed what looked like a mac address and hostkey.
  • winscp - Copy.log (21.02 KB, Private file)

Reply with quote

fil
Joined:
Posts:
2

I'll add that our goal is to have this script doing the file copying, occur daily, even when logged out of the Windows server, so I suppose-schedule it to run as a scheduled task.

Reply with quote

Guest

I'll also mention that before when the error 5 "Access is Denied" had occurred, I had checked the folder (as well as the file in it that was failing to copy), and both had the LocalHostname\Administrators group on NTFS permissions with Full Control on it. The account I was running the command as is a domain admin account that WAS present in that local Administrator group. However, I added that individual account to the folder anyways, with Full Control.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: GET to copy wildcard files works from linux to windows, but not PUT (wildcard) from Windows to Linux

So what's wrong in log? I can see that you run put R:\OurLinuxDB_TO_SF\*.* /salesforce/OurLinuxDB_TO_SF/.
And it uploads three files.
What's wrong about that? What did you expect differently?

Regarding your command-line: You should remove all this from the command-line: "%2Fsalesforce%2Fsysadmin%40MyLinuxServer" /Desktop /UploadIfAny.

And put this to your script file: open sftp://.../ -hostkey="ssh- 256 ", as the log suggests.

I do not see any prompt for anything in the log file.

Reply with quote

fil

Thanks Martin, it's working now with that script change. I assume I can just create a sheduled task with that "winscp /script" command and have it run hourly or whenever, even when logged out? Also, is there any way to avoid putting the password in plain text on the "open sftp" line?

Reply with quote

Advertisement

You can post new topics in this forum