I am very new when it comes to batch files and I need to copy some files from a directory to another on a windows 2003 server.
I have writeen a simple batch file which looks like this:
@echo off SET Day=%date:~0,2% SET Month=%date:~3,2% SET Year=%date:~6,4% SET cdate=%Year%%Month%%Day% SET localDir=D:\New_Files SET newDir=D:\test COPY "D:\New_Files\*.dat" "D:\test\*.dat" pause rem dir c:\windows
This is all work, bt the problem I am having is that I only need to copy across files whose date is in the past, i.e.:
The list of files is this
Today is the 15th December 2009 and the file for today would like *20091215.dat. I need to copy all and only the files whose date is prior to today, so I should just move the below files:
I have searched high and low on the web and could not find anything: can you please advise on a solution or anywhere where I can find a way to do it?