Solved How to get two days date before today?

May 28, 2014 at 01:33:10
Specs: Linux x86_64
i need batch script to create folder with name : "myfile_TodayDayDate" and in the same time delete the already existing file with name : (myfile_2daysDatebeforeToday) and if today is last day in the month then file name willbe myfile_0,

::if today is 01/06/2014 and two days before today is 30/05/2014,then create file myfile_1 and delete file myfile_30

::if today is the last day in month say:30/06/2014 then the file name will be myfile_0

message edited by eng2000

See More: How to get two days date before today?

Report •

May 28, 2014 at 07:03:16
Batch doesn't do dates. Either VBScript or PowerShell has no issues with dates, but you're not using those languages.

I suggest you change your problem from, "I want to keep only 2 days worth," to, "I want to keep only the 2 most recent copies."

How To Ask Questions The Smart Way

Report •

May 28, 2014 at 18:45:32
✔ Best Answer
here's a vbscript method from batch:
@echo off
>d2.vbs echo wscript.echo dateadd("d",-2,date)
for /f %%a in ('cscript /nologo d2.vbs') do echo %%a

Report •
Related Solutions

Ask Question