Topic "Rename file to date while uploading it"

Author Message
00O00O00

Guest


Hi. I would need a script to upload files to a FTP server with adding the date to the filename automatically. Now I' using this without WinSCP:

Code:
set year=%date:~-4%
set month=%date:~-7,2%
set day=%date:~-10,2%
set year=%date:~-4%
set month=%date:~-7,2%
set day=%date:~-10,2%

@echo off

echo open xyz.com> upload1.ftp
echo ...>> upload1.ftp
echo ...>> upload1.ftp

echo binary>> upload1.ftp
echo hash>> upload1.ftp
echo cd Backup>> upload1.ftp
echo cd Server>> upload1.ftp
echo put ..\backup.7z.001 backup%day%%month%%year%.7z.001>> upload1.ftp

echo quit>> upload1.ftp

ftp.exe -v -s:upload1.ftp


How can I realise a simular "rename to date" function with WinSCP?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
You can implement it exactly the same way.

Or easier, use %TIMESTAMP% syntax.
http://winscp.net/eng/docs/script_download_timestamped_filename#scripting
http://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