How to put the date usual format in Winscp script?

Advertisement

Tom_shen
Guest

How to put the date usual format in Winscp script?

I use winscp script to get file from server.
normal file is ok. but i met some file with the date in the file name. such as 20080708abcd.txt.
could i use any funcation to get this kind of file?
could winscp script sopport this?

Reply with quote

Advertisement

tom_shen
Guest

If i do not have PHP tool on my side, Any other method to download the file.
The file name format is YYYYMMDD_xxxxxxx.XLS

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

tom_shen wrote:

If i do not have PHP tool on my side, Any other method to download the file.
The file name format is YYYYMMDD_xxxxxxx.XLS
What is your side? You can use any other scripting language anyway.
_________________
Martin Prikryl

Reply with quote

steve
Guest

dates in scripts

get realdate.com from www.huweb.hu/maques/realdate.htm
then call winscp from a batch file thus :-


for /f %%i in ('realdate.com /d') do (set DT=%%i)
"C:\Program Files\WinSCP\WinSCP.exe" /console /script=m:/app/cron/auto.ftp
exit

Then in your ftp script get a date in the form 20080724 using %DT% :D

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: dates in scripts

steve wrote:

get realdate.com from www.huweb.hu/maques/realdate.htm
then call winscp from a batch file thus :-


for /f %%i in ('realdate.com /d') do (set DT=%%i)
"C:\Program Files\WinSCP\WinSCP.exe" /console /script=m:/app/cron/auto.ftp
exit

Then in your ftp script get a date in the form 20080724 using %DT% :D
Thanks for the hint. I have added it to example.

Reply with quote

o5tech
Joined:
Posts:
1

Re: dates in scripts

Thanks for the example but I cannot use %DT% in my script.

My script is something like:
...
put C:\%DT%\*.* /tmp
...

And I have the following error:
File or folder 'C:\%DT%\*.*' does not exist.

What I have to do?
Thanks!!!

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: dates in scripts

o5tech wrote:

Thanks for the example but I cannot use %DT% in my script.

...

And I have the following error:
File or folder 'C:\%DT%\*.*' does not exist.
First make sure that you have the latest version of WinSCP. Also you may need to enable windows shell extensions for the advanced usage of for command.
_________________
Martin Prikryl

Reply with quote

Guest

Re: dates in scripts

martin wrote:


First make sure that you have the latest version of WinSCP. Also you may need to enable windows shell extensions for the advanced usage of for command.

The error was that I had not the latest version of WinSCP.
Thanks!

Reply with quote

ritika
Guest

winscp

I need to download file(filename with today's date in it) from Linux server using winscp.I am using WINSCP.COM /script and running it by batch script.how can I specify current date with its proper formatting(dd_mm_yyyy) in winscp.com so it downloads desired file.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: winscp

ritika wrote:

I need to download file(filename with today's date in it) from Linux server using winscp.I am using WINSCP.COM /script and running it by batch script.how can I specify current date with its proper formatting(dd_mm_yyyy) in winscp.com so it downloads desired file.

get /path/prefix%TIMESTAMP#dd_mm_yyyy%suffix c:\path\

See https://winscp.net/eng/docs/scripting#timestamp

Reply with quote

Advertisement

You can post new topics in this forum