Hello Experts,
This is the situation.
D:/Main folder
Folder-1
sub folder -----> make todays date folder -26-11-2013
Folder-2
sub folder -----> make todays date folder
Folder-3
sub folder -----> make todays date folder
...
I want to create the current date folder in all the subfolders with a singe go.
That will ease my work.
Thanks is advance.
Make folders on todays date
Moderator: DosItHelp
Re: Make folders on todays date
Going by your example:
%date% will display/use the current date
output:
If you do not want dots in the foldernames you can do:
note: i'm using a german windows version, so the day and month might be swapped on diffrent language versions
Code: Select all
md folder-1
pushd folder-1
md %date%
popd
...
%date% will display/use the current date
Code: Select all
echo:%date%
output:
Code: Select all
26.11.2013
If you do not want dots in the foldernames you can do:
Code: Select all
@echo off
set "day=%date:~0,2%"
set "month=%date:~3,2%"
set "year=%date:~6,4%"
:: :~6,4 for a four digit display i.e: 2013, :~8,2 for a two digit display i.e.: 13
set "cur_date=%day%-%month%-%year%"
md folder-1
pushd folder-1
md %cur_date%
popd
note: i'm using a german windows version, so the day and month might be swapped on diffrent language versions
Re: Make folders on todays date
Launch this in your main folder - it is untested:
The first four lines of this code will give you reliable YY DD MM YYYY HH Min Sec variables in XP Pro and higher.
The first four lines of this code will give you reliable YY DD MM YYYY HH Min Sec variables in XP Pro and higher.
Code: Select all
@echo off
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set "datestamp=%DD%-%MM%-%YYYY%" & set "timestamp=%HH%%Min%%Sec%"
for /d %%a in (*) do md "%%a\folder-%datestamp%"
Re: Make folders on todays date
Thanks EXPERTS.
Thanks a lot.
Thanks a lot.