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

Author Message
TR2N_

Guest


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:

Code:
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
Code:
filemask=">3D"
. But i can´t get it to work probably, regardless where i add it, it throws me errors:

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


or e.g.

Code:
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Code:
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
[View user's profile]

Joined: 2015-07-02
Posts: 8
Hello prikryl,

when i enter following command on my Windows command line:

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


...i get follwing output:

Code:

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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Chances are you are using an old version of WinSCP. Make sure you use the latest one.
TR2N
[View user's profile]

Joined: 2015-07-02
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

Code:
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:

Code:
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
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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
[View user's profile]

Joined: 2015-07-02
Posts: 8
Hello prikryl,

first i want to thank you for your support, it is very appreciated! Smile

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

Code:

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
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
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.
TR2N
[View user's profile]

Joined: 2015-07-02
Posts: 8
prikryl wrote:
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.


Hi Prikryl,

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

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

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
The /data1/umdav/log is a symlink. WinSCP got confused by that.

Use a final path /data2/umdav/log instead.
TR2N
[View user's profile]

Joined: 2015-07-02
Posts: 8
Hi Prikryl,

YEEEEEES! Now it works like it should! Thank you so much!!!
TR2N
[View user's profile]

Joined: 2015-07-02
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:

Code:
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Most likely you have quotes wrong:
http://winscp.net/eng/docs/commandline#syntax

You need to show us your batch file, if you need help.
TR2N
[View user's profile]

Joined: 2015-07-02
Posts: 8
Hi prikryl,

here is my batch file:

copyX.bat

Code:

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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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
[View user's profile]

Joined: 2015-07-02
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
Code:
.\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
Code:
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!
3.PNG (13.25 KB)

Description: Executing the command with a powershell sript

3.PNG

2.PNG (6.25 KB)

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

2.PNG

1.PNG (5.23 KB)

Description: Entering batch file to execute it

1.PNG

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
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?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License