So I've been trying to make a automatic backup and date stamp bat program for a folder and its contents. The first time it loops it does exactly what i want it to. But the second time the loop runs, it changes the folder by removing the first 3 numbers and the 0 in 2014. It looks like this.
First loop C:\users\username\desktop\05.26.2014\17.11\contents(This is right)
Second loop C:\user\username\desktop\6.2.14\17\contents
Third loop C:\users\username\desktop\2.1\no time folder\contents
There is a time sub folder in the date folder it is also affected by this until it does not generate anymore. Can anyone tell what is causing this, here is what i have in the bat file
@echo off
set /a x=0
:loop1
timeout /t 600
set day="%date:~-10,2%"
set month="%date:~-7,2%"
set year="%date:~-4,4%"
set hour="%time:~-11,2%"
set minute="%time:~-8,2%"
set time="%hour%.%minute%"
set date="%day%.%month%.%year%"
echo d | XCOPY Z:\copydirectory "G:\pastdirectory" /e
echo Loop number -^>%x%
set /a x=%x%+1
if %x% NEQ 10000 goto loop1
pause
Thanks to anyone who answers.
Edit: changed
variable time to T and variable date to D
That seems to have fixed it.