Creating folder on my FTP with batch

October 16, 2012 at 13:11:43
Specs: Windows 7

I need help to create a folder for each day.
The folder have to be created before midnight, and It have to create a folder with the date for the next day. The format of the new folder should be year_month_day.

Like this: 2012_10_16.

Here is the batch i use now:

@echo on

set fra=C:/AdminMap0.98kAlpha/Profiles/TK/logs/%date:~-4%_%date:~3,2%_%date:~0,2%
set til=/public_html/logs/%date:~-4%_%date:~3,2%_%date:~0,2%

for /f "tokens=*" %%a in ('dir /b /od "%fra%" 2^>nul') do set newest=%%a

>rel.txt (
echo OPEN
echo HOST
echo lcd %fra%
echo mkdir %til%
echo cd %til%
echo binary
echo MPUT *%newest%*

echo bye


FTP -v -i -s:rel.txt

What can i write here to create a folder for the next day?
The folder should be inserted in

Thank you, and I hope you understand what I write :)

See More: Creating folder on my FTP with batch

Report •

October 16, 2012 at 13:16:10

I need to make the folder %fra% before midnight. SO that the %fra% folder is created for the next day.

Report •

October 16, 2012 at 18:48:25
datemath using batch is not to be recommended, unless you like to be frustrated. It is cumbersome and often unreliable. So, with that consideration, vbscript is the way to go. A vbscript one-liner will do what you want:
wscript.echo(year(date+1) & "_"&month(date+1) & "_" & day(date+1))

and a couple of lines in batch to apply and collect it:
::==== begin batch snippet
> d1.vbs echo wscript.echo(year(date+1) & "_"&month(date+1) & "_" & day(date+1))
for /f %%a in ('cscript d1.vbs') do set tomoro=%%a
::==== end batch

Assuming it works (always a long shot), I'll leave it to you to build it in since you seem to know your way around coding this project.

Report •

Related Solutions

Ask Question