Batch file to move file based on Month & Year on Date modified to folder with YYYY_MM -
anyone can me create batch file move *.xml file x folder yyyy_mm folder based on month & year on date modified xml file?
i not sure put inside loop.
@echo off echo date %date% dir /od/b "c:\users\*.xml" > test.log /f %%f in (test.log) ( )
at first want put set var = %%~tf
inside loop later can use substring on var month , year , can move xml file yyyy_mm folder based on that, seems it's not working.
try this[no robocopy required]:
@echo off set "src=c:\test" set "dest=c:\test" %%f in ("%src%\*") ( /f "tokens=1,2,3 delims=/ " %%a in ("%%~tf") ( if not exist "%dest%\%%c_%%a" mkdir "%dest%\%%c_%%a" move "%%~ff" "%dest%\%%c_%%a" ) )
Comments
Post a Comment