Changing folder based on date

Advertisement

Ondrej
Joined:
Posts:
2
Location:
Czech republic

Changing folder based on date

Hi,
I am facing to an issue with changing directory based on date.
My command is:

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="D:\BATCHES\LOGS\CRE_WINSCP.log" /ini=nul ^
  /command ^
    "open sftp://....." ^
    "cd /ucpex/P/eurex/%TIMESTAMP-1D#YYYYMMDD%/" ^
    "get  *XML.ZIP D:\BATCHES\TEMP_FILES" ^
    "exit"

Unfortunately it absolutely ignores the part for changing directory based on date please log below:

...
. 2019-04-10 09:29:17.851 Startup conversation with host finished.
< 2019-04-10 09:29:17.851 Script: Active session: [1] 1059233_000002@193.29.90.132
> 2019-04-10 09:29:17.852 Script: cd /ucpex/P/eurex//
. 2019-04-10 09:29:17.852 Changing directory to "/ucpex/P/eurex//".
. 2019-04-10 09:29:17.852 Getting real path for '/ucpex/P/eurex//'
> 2019-04-10 09:29:17.852 Type: SSH_FXP_REALPATH, Size: 25, Number: 272
< 2019-04-10 09:29:17.879 Type: SSH_FXP_NAME, Size: 49, Number: 272
. 2019-04-10 09:29:17.880 Real path is '/ucpex/P/eurex'
. 2019-04-10 09:29:17.880 Trying to open directory "/ucpex/P/eurex".
> 2019-04-10 09:29:17.880 Type: SSH_FXP_LSTAT, Size: 23, Number: 519
< 2019-04-10 09:29:17.901 Type: SSH_FXP_ATTRS, Size: 37, Number: 519
. 2019-04-10 09:29:17.901 Getting current directory name.
< 2019-04-10 09:29:17.901 Script: /ucpex/P/eurex
> 2019-04-10 09:29:17.902 Script: get  *XML.ZIP D:\BATCHES\TEMP_FILES
. 2019-04-10 09:29:17.902 Listing directory "/ucpex/P/eurex".
> 2019-04-10 09:29:17.902 Type: SSH_FXP_OPENDIR, Size: 23, Number: 779
< 2019-04-10 09:29:17.923 Type: SSH_FXP_HANDLE, Size: 13, Number: 779
> 2019-04-10 09:29:17.923 Type: SSH_FXP_READDIR, Size: 13, Number: 1036
< 2019-04-10 09:29:18.163 Type: SSH_FXP_NAME, Size: 2559, Number: 1036
> 2019-04-10 09:29:18.163 Type: SSH_FXP_READDIR, Size: 13, Number: 1292
< 2019-04-10 09:29:18.180 Type: SSH_FXP_STATUS, Size: 28, Number: 1292
< 2019-04-10 09:29:18.180 Status code: 1
> 2019-04-10 09:29:18.180 Type: SSH_FXP_CLOSE, Size: 13, Number: 1540
...

Could you advise me please?

Thank you in advance,
Ondrej

Reply with quote

Advertisement

andres3626
Joined:
Posts:
1
Location:
Ecuador

Script creation

Good day. Could you tell me if the following is okay. Especially the issue of the date of a previous day. The files are called 20200811JODHOY.log and 20200811JODHOY.DMP and I want to copy them to daily, change the date of the previous day, so today I copy the files with yesterday's date. The script below is well created?
@echo off
open scp://suchas:random45@200.34.56.78/ -hostkey="ssh-rsa 2048 fG5h60iJKillL3YUlcZkcqQniqX1Pj="
cd /resp_expdp/DIARY_CH
get %TIMESTAMP-1D#yyyy-mm-dd%*.* d:\
exit
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
exit /b %WINSCP_RESULT%

Reply with quote

Advertisement

You can post new topics in this forum