Topic "A way to mkdir with today's date variable?"

Author Message
Sid
[View user's profile]

Joined: 2009-09-21
Posts: 2
Hi there.

First, thanks for the excellent program and its user-friendly scripting!

My question: Is there a way to create a directory using a variable such as the current date and/or time?

I've got to ftp download a large number of files every day and would like to have WinSCP locally create a directory using the current date.

Please give me a few explicit examples, as I'm a newbie with advanced scripting.

Thank you!

-Sid
Sid
[View user's profile]

Joined: 2009-09-21
Posts: 2
For those of you needing something similar, here's a DOS Batch script you can run to create a directory with the timestamp as the name.

set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set yyyy-mm-dd__hh.mm.ss=%date:~10,4%-%date:~4,2%-%date:~7,2%__%hh%.%time:~3,2%.%time:~6,2%---%date:~-0,3%
MD C:\Archive\%yyyy-mm-dd__hh.mm.ss%
Move D:\downloads\*.* C:\Archive\%yyyy-mm-dd__hh.mm.ss%

Put the above into a text file, rename the extension to .bat and schedule it after how many ever hours it takes for your download to complete.
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