help

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
alexx12345
Posts: 1
Joined: 24 Feb 2011 05:28

help

#1 Post by alexx12345 » 24 Feb 2011 05:39

ive been using Dos for 2 days now and i now need some help.

im trying to create a file that will copy files from a folder that are less than 2 days old, then move them to another folder where they will then be deleted.

the trouble ive had is that all the original Dos files get deleted once ive copied and removed the files into the folder they have been moved to.

i then realised that it was either very hard or impossible to do this with a normal Dos batch file so ive decided to download xxcopy so i have more commands and options to use. i am very unfarmiliar with this software aswell as Dos itself so i need some help creating the rest of the file.

here is the contents of my file -

echo 1FileDate %1
echo 1FileName %2
echo 1TodaysDate %3


call :FileDayNo %1
set FileDays=%DateNo%
echo 1FileDays-%FileDays%

pause

rem Now Calc File Age and delete if over %FileAge% days old

pause

XXCOPY [source] [destination] /DA#2 /DB#1

pause

rem Get Date Number=============================================
: FileDayNo %1
echo in subroutinex

for /f "tokens=1-3 delims=/- " %%a in ("%1") do (
set dd=%%a
set mm=%%b
set yy=%%c
)
echo out of forloop
pause
echo Get Date:Day-%dd%
echo Get Date:Month-%mm%
echo Get Date:Year-%yy%
pause
set /a DateNo=%dd%+(%mm%*306001/10000)+(%yy%*1461/4)
echo calculated day no is-%DateNo%
pause
exit /b

Thanks,
Alex

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: help

#2 Post by aGerman » 25 Feb 2011 13:25

Have a look at the first example here :wink:

Regards
aGerman

Post Reply