A way to mkdir with today's date variable?

Advertisement

Sid
Joined:
Posts:
2

A way to mkdir with today's date variable?

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

Reply with quote

Sid
Joined:
Posts:
2

Found a DOS Batch file as a work around for the time being.

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.

Reply with quote

Advertisement

You can post new topics in this forum