On May 8, 9:56 am, Paloma <Pal...[ at ]discussions.microsoft.com> wrote:
[Quoted Text] > Hi, > > I am trying to run a simple batch that compares the dates of two files (one > is on the server and the other is on the local computer) the conditions are: > if the file on the local Pc is older than the file on the server, delete it > and then copy the new one. > Is the fc command the one I have to use? because it is not working, I don't > know how to compare the dates, Does anyone know how to do it? This is the one > I was trying to use but it is not completed yet. > > rem comparison between PCS and test > fc Z:\batch file.bat C:\Batchfile\batch file.bat > if errorlevel 1 goto newer > goto end > :newer > echo The test file is NEWER than the PCS file. > del C:\BatchFile > COPY Z:\*.* C:\BatchFile > goto end > :end > pause > > Thanks in advance
Look at the /D switch for the xcopy utility. It does all of the work for you.
Type XCOPY /? at a command prompt.
Tom Lavedas
|