problem with cache using script

Advertisement

Leti
Guest

problem with cache using script

I use a script in order to recover my log files on the server. They're in a path like : exec/applis/myAppli/current/logs, current indicating the active version of the application.

When I launch my script, instead of going in active "current", WinSCP goes in the last "current" visited on this server. I tried to empty the cache via WinSCP, but it doesn't works.

An idea how to regulate this problem ?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: problem with cache using script

Setup a stored session with option "Cache directory changes" turned off. Use that stored session from your script.
Last edited by martin on 2021-08-23; edited 1 time in total

Reply with quote

Leti
Guest

Re: problem with cache using script

we can use the stored sessions from the scripts ?? because I have stored all the session I use to launch (one per server), so if it's possible to launch them, it would be interessant to me :-) ...

however, if you have an example calling a session with all parameters defined (host, login ...) and an example with a session "empty", I would be very happy :-)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: problem with cache using script

Both command line parameter and script command open parameter can be name of stored session. Only if the value is not existing session it is treated (parsed) as an URL.

See
winscp3 /?
or
help open
(from console)

Edit 2021: But it's not recommended to use stored session in scripting,
see https://winscp.net/eng/docs/scripting#configuration
Last edited by martin on 2021-08-23; edited 1 time in total

Reply with quote

Leti
Guest

I have try at this moment, but it doesn't works :( ...

I use a script that recover the logs from several servers :
 rem boucle sur les serveurs 
for /L %%i in (68,1,80) do call ::Go %%i 
goto :end 
 
 rem Creation du fichier des commandes SFTP 
echo option confirm off>sftp.txt
echo open %LOGIN%:%PASSWORD2%@xx.xxx.xxx.%1>>sftp.txt 
echo cd ../../exec/applis/myAppli/current/logs>>sftp.txt 
echo option transfer binary>>sftp.txt
echo get *.log c:\recup_FTP\80\>>sftp.txt 
echo close>>sftp.txt 
rem echo exit>>sftp.txt 
 
winscp3 /console /script=sftp.txt
as you can see, I make my script for each server, opening the session with login, password and host in parameter.

how can I open a session stored in WinSCP? I have tried to use the command:
open nameOfMySession
but then it ask for the login and password :-( ...

Reply with quote

Advertisement

Leti
Guest

It's a .bat script, that I run from my Windows Desktop ... So, it didn't use a particular account ...
This is the script launched by WinSCP :
option confirm off
open login:password@xx.xxx.xx.xx
cd ../../exec/applis/myAppli/current/logs 
option transfer binary
get *.log c:\myDirectory\ 
close

I've read your FAQ, I have activated the .ini file and configured the options of cache I wanted:
[Sessions\Default%20Settings]
CacheDirectories=0
CacheDirectoryChanges=0
PreserveDirectoryChanges=0
It works! thank you for your help!

Reply with quote

Advertisement

You can post new topics in this forum