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

Author Message
fil

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26572
Location: Prague, Czechia
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.
Guest




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

Description: (none)

fil
[View user's profile]

Joined: 2017-07-25
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.
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26572
Location: Prague, Czechia
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.
fil
[View user's profile]

Joined: 2017-07-25
Posts: 2
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26572
Location: Prague, Czechia
See
https://winscp.net/eng/docs/guide_schedule
and
https://winscp.net/eng/docs/guide_protecting_credentials_for_automation
Advertisements

You can post new topics in this forum






Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License