If your script fails, add /log="C:\path\to\winscp.log" to your command line to see exactly what went wrong. Common Commands Summary Table Description open Start the connection (requires protocol, user, pass, host). get Download a specific file or folder. lcd Change the local working directory. cd Change the remote working directory. synchronize Download only new/changed files from the server. exit Close the WinSCP console.
If you need to download all logs or all images from a folder, use the * wildcard. get /logs/*.log C:\LocalLogs\ Use code with caution. Example 4: Syncing an Entire Directory download file using winscp command line example
The graphical user interface (GUI). Running this from the CMD usually just opens the window. Example 1: Simple SFTP Download (The "One-Liner") If your script fails, add /log="C:\path\to\winscp
# Syntax: synchronize local [local_dir] [remote_dir] synchronize local C:\LocalProject /www/production Use code with caution. Pro-Tips for Command Line Success lcd Change the local working directory
If your script fails, add /log="C:\path\to\winscp.log" to your command line to see exactly what went wrong. Common Commands Summary Table Description open Start the connection (requires protocol, user, pass, host). get Download a specific file or folder. lcd Change the local working directory. cd Change the remote working directory. synchronize Download only new/changed files from the server. exit Close the WinSCP console.
If you need to download all logs or all images from a folder, use the * wildcard. get /logs/*.log C:\LocalLogs\ Use code with caution. Example 4: Syncing an Entire Directory
The graphical user interface (GUI). Running this from the CMD usually just opens the window. Example 1: Simple SFTP Download (The "One-Liner")
# Syntax: synchronize local [local_dir] [remote_dir] synchronize local C:\LocalProject /www/production Use code with caution. Pro-Tips for Command Line Success