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
Solved

how do i add date to my folder name/

Posted on 2007-03-24
3
425 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to count occurrences of each item in an array.

856 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