# Transfer files from Windows to Linux

saikarthik.vempati
Joined:
Posts:
1
Location:
USA

## Transfer files from Windows to Linux

Hello,

I'm trying to create a batch file to automate the process of log transfer of logs from Windows server to Linux server using WinSCP commands for logs that are greater than or equal to 1 day. I have the following command and it fails with the message "The filename, directory name, or volume label syntax is incorrect."

Can someone help with the correct syntax?

Below is the command.
winscp.exe /ini=nul /log=C:\winscp\winscp.log /command "open sftp://account@ip_address -privatekey="C:\privatekey.ppk"" "put -filemask="*>=1D "D:\logs\* /linuxserver/logs/" "exit"

martin
Joined:
Posts:
37,201
Location:
Prague, Czechia

## Re: Transfer files from Windows to Linux

You have the quotes wrong. And also there must be space after the quote before the D:\logs\*:
"put -filemask=""*>=1D"" D:\logs\* /linuxserver/logs/"
See https://winscp.net/eng/docs/commandline#syntax

If this does not help, please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log 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.

You can post new topics in this forum