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?

有帮助吗?

解决方案

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

其他提示

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"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top