Skip to content

Instantly share code, notes, and snippets.

@angusdev
Created December 18, 2014 02:00
Show Gist options
  • Select an option

  • Save angusdev/764c1ae7b1e199275f46 to your computer and use it in GitHub Desktop.

Select an option

Save angusdev/764c1ae7b1e199275f46 to your computer and use it in GitHub Desktop.
@REM Copy foo.txt to foo.20141218.txt
@REM Assuming Window's date format is Mon 12/18/2014
@set FROMFILE=foo.txt
@setlocal
@echo off
FOR /D %%f in (%FROMFILE%) do (
set TOFILE=%%~nf.%date:~10,4%%date:~4,2%%date:~7,2%%%~xf
)
@echo on
copy %FROMFILE% %TOFILE%
@endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment