Topic "Rename file to date while uploading it"

Author Message


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:

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> 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?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
You can implement it exactly the same way.

Or easier, use %TIMESTAMP% syntax.

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License