Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Xcopy in Batch File Only new files  (Read 3217 times)

0 Members and 1 Guest are viewing this topic.

too_eazy

  • Guest
Xcopy in Batch File Only new files
« on: November 04, 2005, 09:43:23 AM »
I'm trying to xcopy from one pc to another both are XP.  I created a batch file to do the xcopy and it works fine.  However, I would like to limit this to include only files that have been created in the last 4 days.

This is what I have and it works.

xcopy "x:\" "e:\" /s /e /y /c /z

I need help creating a variable for %date%-4 and passing it into my xcopy /d switch.


Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Xcopy in Batch File Only new files
« Reply #1 on: November 04, 2005, 05:02:35 PM »
Batch files do not do date and time calculations unless you are prepared to write a boatload of IF statements.

Case in point:

Today = 11/04/2005

Subtract 4. What day do you reckon 11/00/2005 might be?

8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein