Skip to content

Instantly share code, notes, and snippets.

@bhavika
Last active January 8, 2016 14:22
Show Gist options
  • Save bhavika/f9bb4c61959cc67d83af to your computer and use it in GitHub Desktop.
Save bhavika/f9bb4c61959cc67d83af to your computer and use it in GitHub Desktop.
Batch file to copy a folder to a destination and change its name to the current date
set source= source path
set destination= dest path
for /f "tokens=2 delims==" %%G in ('wmic os get localdatetime /value') do set datetime=%%G
set year=%datetime:~0,4%
set month=%datetime:~4,2%
set day=%datetime:~6,2%
set folder = "Books"
xcopy /s /i %source% %destination%_%year%-%month%-%day% /E /y
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment