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

Advertisement

TR2N_
Guest

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

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?

Reply with quote

TR2N
Joined:
Posts:
8

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
Last edited by TR2N on 2015-08-04 13:06; edited 1 time in total

Reply with quote

TR2N
Joined:
Posts:
8

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar

It's:

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

Reply with quote

TR2N
Joined:
Posts:
8

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

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.

Reply with quote

TR2N
Joined:
Posts:
8

Hi Prikryl,

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

Kindly regards
Nico
  • Log.txt (18.09 KB, Private file)

Reply with quote

Advertisement

TR2N
Joined:
Posts:
8

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

Reply with quote

Advertisement

TR2N
Joined:
Posts:
8

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

Reply with quote

martin
Site Admin
martin avatar

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?

Reply with quote

TR2N
Joined:
Posts:
8

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!

Description: Executing the command with a powershell sript

3.PNG

Description: Error when using a batch file that has the WinSCP command included

2.PNG

Description: Entering batch file to execute it

1.PNG

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

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?

Reply with quote

Advertisement

You can post new topics in this forum