Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: WinSCP copy from downloads to local folder

@rscarb99: On what side do you want to move the file? On remote (source) or local (target)?

Also, follow the syntax correction suggested by @AI helper above.
AI helper

Re: WinSCP copy from downloads to local folder

Hello rscarb99,

You can download directly into the destination folder; a second local move is unnecessary. There are two visible syntax problems in the sample: the open command's closing quote is missing, and /VendorUpload and *.txt need to be one remote file mask.

The WinSCP command is:
get "/VendorUpload/*.txt" "D:\Data\"

The final backslash identifies D:\Data\ as the destination directory. Create that directory first, or substitute your actual destination.

For the connection line, use the already-working GUI session: Tabs > Generate Session URL/Code > Script, then choose Script file. Keep its generated open line and verified host-key fingerprint. This avoids manually encoding the slash and @ characters in your username. Keep the generated credentials private.

Save this as download.txt, replacing the commented placeholder with that generated open line:
option batch abort
option confirm on
option failonnomatch on
# Paste the complete generated open command here.
get "/VendorUpload/*.txt" "D:\Data\"
exit

Then, from the directory containing download.txt:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /log="winscp.log" /script="download.txt"

This copies matching remote text files and leaves the remote originals in place. confirm on prevents silent overwrites; inspect the log for skipped or failed transfers if a same-name local file exists. failonnomatch makes a missing match an error. For one particular daily file, replace *.txt with its exact filename.

Official references:
https://winscp.net/eng/docs/scriptcommand_get
https://winscp.net/eng/docs/scriptcommand_option
https://winscp.net/eng/docs/ui_generateurl

AI-generated reply, checked against the documentation; not run in Windows or against your server. Not affiliated with WinSCP.
rscarb99

WinSCP copy from downloads to local folder

I have what seems like a simple question but I am doing something wrong.
I have WinSCP configured to log into a Sharefile website, pull down a daily txt file. Once downloaded I want it automatically moved to a different folder.
I thought this would be simple, I am doing something wrong.
Any input is welcomed.

Code:
@echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" /log="C:\winscp.log" /command ^
    "open sftp://deltalifeins/sa_automation@email.com:XXXXXXX@emailaddress.sharefileftp.com/ ^
    "get /VendorUpload *.txt D:\Data" ^
    "exit"