Many times I had to create directories with date as name for different purposes. I made this batch script to make that task easy. This is handy to keep all work of a particular day in its own folder. The following batch script will create directory of name format DDMMYYYY in the current path.
:: Auto directory date batch (MMDDYYYY format) :: First parses month, day, and year into mm , dd, yyyy formats and then combines to be DDMMYYYY :: Setups %date% variable :: @author Deepu Mohan Puthrote http://deepumohan.com @echo off FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B SET date=%dd%%mm%%yyyy% echo New folder name %date% MKDIR %date%
Copy and paste this code into a file with extension bat and save it into a path where you want to create the directory. Double click on the batch file to create the current day’s directory.comments powered by Disqus