how to get today's modified folders in a directory using batch file

前提是你 提交于 2020-01-11 13:48:28

问题


I have a folder "Projects" and it contains multiple folders for different projects in it, I want to back-up that folder which has some modifications today( it can be single project or can be more than one).

set ProjectFolder=D:\Projects    

for %%o IN (%ProjectFolder%/*.*) DO (
 echo %%o 
 set Project1Folder=%%o
 xcopy "%Project1Folder%\*.*" "%NetworkFolder%\%Project1Folder%\backup_%CurrentDate%\" /s/h/e/k/f/c 
)

And how to pass foldername(modified project) to be be copied in a loop.

Note :- trying something like below but how to get today's modified folder(s) only..

EDIT:-

set MainFolder=D:\Projects          
set LocalFolder=D:\backup

for /d %%D in (%MainFolder%/*.*) do (  
set ProjectFolder=%%~fD
xcopy "%%~fD\*.*" "%LocalFolder%\" /s/h/e/k/f/c /D:03-23-2018
)   

Edit2:-

for /D %%A in ("%LocalFolder%\*") do (
 echo %%~fA
for /F %%N in ('forfiles /S /P %%~fA /M "*" /D +0 /C "cmd /C if @isdir==FALSE echo _" ^| find /C "_"') do set "NUMBER=%%N"
echo %NUMBER%
if %%N GTR 0 xcopy "%%~fA\*.*" "%LocalFolder%\" /s/e/k/f/c
 )

来源:https://stackoverflow.com/questions/49448609/how-to-get-todays-modified-folders-in-a-directory-using-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!