Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how do i add date to my folder name/

Posted on 2007-03-24
3
Medium Priority
?
429 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 2000 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

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

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…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

730 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