Post a reply

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

Can you remove the cls and @echo off and show a screenshot for run the batch file again?

Any chance, you have multiple copies of winscp.com/exe for a different version of WinSCP, executing a different version each time?

Can you try to use a full path to the latest version of WinSCP in the .bat?
TR2N

That is exactly my problem. When i paste this command into a cmd.exe window, the command works as it should. When i paste this line into a batch file and excute it, the "too many parameters" error appears.

But when i paste the command into a .ps Powershell sript file, it works!??

winscp_test.ps1
.\WinSCP.com /command "open scp://user:password@host" "synchronize local -filemask=>3D D:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data2/umdav/log" exit

--/> See attachment, it works!


winscp_test.bat
cls

@echo off
WinSCP.com /command "open scp://user:password@host" "synchronize local -filemask=>3D D:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data2/umdav/log" exit
exit

--/> See attachment, it does not work when this command is inside a batch file!



BTW: Can you please edit the first post i made with my guest account and remove the user/password/host informations?

Thank you and kindly regards!
martin

I do not get any errors when running this command (which is correct).

Can you attach a screenshot of cmd.exe window, where you paste the command and execute it?
TR2N

Hi prikryl,

here is my batch file:

copyX.bat

cls

@echo off
WinSCP.com /command "open scp://user:password@host" "synchronize local -filemask=>3D D:\UMD_Logs\04_ExternesTestsystem\srunavte1 /data2/umdav/log" exit
TR2N

Sorry Prikryl,

one problem left... When i enter the proper command into the commandline window directly, it works. But when i paste the line into a batch-file (.bat), i get following error:

too many parameters for command 'open'


What can i do? I am using the latest version. I want to add a job to the Task Scheduler for that, but i can´t because of this error.

Kindly regards
TR2N

Hi Prikryl,

YEEEEEES! Now it works like it should! Thank you so much!!!
martin

The /data1/umdav/log is a symlink. WinSCP got confused by that.

Use a final path /data2/umdav/log instead.
TR2N

Hi Prikryl,

I have the log attached to this post. Thank you!

Kindly regards
Nico
martin

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

To generate 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.
TR2N

Hello prikryl,

first i want to thank you for your support, it is very appreciated! :-)

Sadly, i got this output when i enter the command:

E:\Data>WinSCP.com /command "open scp://user:password@host" "synchronize local -filemask=>1D E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit

Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] user@host
Using configured transfer settings different from factory defaults.
Comparing...
Local 'E:\UMD_Logs\04_ExternesTestsystem\srunavte2' <= Remote '/data1/umdav/log'

Synchronizing...
Copying file '/data1/umdav/log/log' failed.
Received error message from remote side: 'scp: /data1/umdav/log/log: No such file or directory'
(O)K, (A)bort: Abort

E:\Data>


I really con´t know, why he added a second /log or he tries to copy this. There is no log directory inside log...

Thank you very much!
Nico
martin

It's:

WinSCP.com /command "open scp://user:password@sun" "synchronize local -filemask=>1D E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit
TR2N

Lol, you are right. My version was to old. It works now. But i don´t understand where to insert the OPEN command. When i run

WinSCP.com /open scp://user:password@sun /command "synchronize local -filemask=>1D E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit


from the command line, it works.

When i put this line into a batch file (sync.bat), i get following message:

Opening session using command-line parameter in scripting is deprecated. Use 'op

en' command instead.
Searching for host...
Host "it takes my user(????)" does not exist.
winscp>


It seems that the batch script is parsing my command not correctly. How can i fix that?

Kindly regards
martin

Chances are you are using an old version of WinSCP. Make sure you use the latest one.
TR2N

Hello prikryl,

when i enter following command on my Windows command line:

WinSCP.com user:password!@host /command "synchronize local -filemask=>3D E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit


...i get follwing output:

Searching for host...

Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user@host
Unknown switch 'filemask'.


And i am back at the command prompt. I am not able to use the filter.

Thank you and kindly regards
Nico
martin

Re: WinSCP.com file synchronization with filemasking not working propably (Solaris -> Win32)

WinSCP.com umdlogcp:T2%Rvrg!@srunavte2 /command "synchronize local -filemask=>3D E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit

This above is correct (except that you should use open to open the session, instead of specifying URL as a separate command-line argument).
What particular problem are you having with it?
TR2N_

WinSCP.com file synchronization with filemasking not working propably (Solaris -> Win32)

Hi guys,

i want to collect some log files from our Solaris hosts. I was doing it with this command batch file on our Windows host before i got the idea to filter some older files:

WinSCP.com <username>:<password>@<hostname> /command "synchronize local E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit


Because of the high amount of files i want to exclude the older ones and wanted to use the filter
filemask=">3D"
. But i can´t get it to work probably, regardless where i add it, it throws me errors:

WinSCP.com <username>:<password>@<hostname> /command "synchronize local -filemask=>3D E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit


or e.g.

WinSCP.com <username>:<password>@<hostname> /command "synchronize local -filemask=">3D" E:\UMD_Logs\04_ExternesTestsystem\srunavte2 /data1/umdav/log" exit


So what i am doing wrong?

Thank you for your help!

Kindly regards
Nico