Question

Here s the .bat I'm using curently:

for %%I in  (I:\ETOS\00-5-1-WA-1
I:\ETOS\00-5-3-WA-1
I:\ETOS\00-5-15-WA-1
I:\ETOS\00-5-18-WA-1
I:\ETOS\00-20-1-WA-1
I:\ETOS\00-20-2-WA-1
I:\ETOS\00-20-14-WA-1
I:\ETOS\00-25-06-2-2-WA-1
) do copy %%I C:\users\admin\desktop\age\to

Right now it just copies the contents of each folder without discrimination. I would like it to copy the entire folder (not just folder contents) and only copy those that have been modified within the last seven days.

Possible?

Was it helpful?

Solution

Test this:

@echo off
for %%a in (
"I:\ETOS\00-5-1-WA-1"
"I:\ETOS\00-5-3-WA-1"
"I:\ETOS\00-5-15-WA-1"
"I:\ETOS\00-5-18-WA-1"
"I:\ETOS\00-20-1-WA-1"
"I:\ETOS\00-20-2-WA-1"
"I:\ETOS\00-20-14-WA-1"
"I:\ETOS\00-25-06-2-2-WA-1"
) do robocopy "%%~a" "C:\users\admin\desktop\age\to\%%~a" /e /maxage:7

OTHER TIPS

This would work on Powershell V3. For example...

Copy-Item -Path C:\Intel -Recurse -Destination C:\Drivers|Where lastwritetime -GT "04/12/2014 12:00:00 AM"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top