Solved

how do i add date to my folder name/

Posted on 2007-03-24
3
428 Views
Last Modified: 2012-06-27
I have this batch from expert here.
I would liek to add the date on the end of each of these folders, but it is not working for me.
please tell me the problem in my script?

setlocal enabledelayedexpansion
for %%a in (data processing audit percentages finalized) do call :process %%a
goto :eof

:process
set /p myDir=Enter the %1 folder name:
md "%mydir%_%date%"
set mydir=
0
Comment
Question by:sher19
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18787009
Hi sher19, you need to grab the month/day/year?  
Use this...(if echo %date% returns the 'day' for you...)

setlocal enabledelayedexpansion
for %%a in (data processing audit percentages finalized) do call :process %%a
goto :eof

:process
set /p myDir=Enter the %1 folder name:
md "%mydir%_%date:~4,2% %date:~7,2% %date:~10%"
set mydir=
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18787011
Oops, actually, use this...I had some spaces in there...

setlocal enabledelayedexpansion
for %%a in (data processing audit percentages finalized) do call :process %%a
goto :eof

:process
set /p myDir=Enter the %1 folder name:
md "%mydir%_%date:~4,2%%date:~7,2%%date:~10%"
set mydir=

0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18787018
Happy to help - thanx for the grade! :^)
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question