Topic "How to put the date usual format in Winscp script?"

Author Message
Tom_shen

Guest


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?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
See examples.
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
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
steve

Guest


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

Thanks for the hint. I have added it to example.
o5tech
[View user's profile]

Joined: 2008-09-26
Posts: 1
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!!!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
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
Guest




prikryl 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!
ritika

Guest


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