Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi
thanks a tons for helping me earlierI am stuck with a small problem
Thru the following code i am able to create the folders
but my problem is that i want to check before creating the folder that whether the folder exists or not::** CODE START
@ECHO OFF
SET MM=%date:~4,-8%
SET DD=%date:~7,-5%
SET YYYY=%date:~-4,10%
SET FOLNAM=%YYYY%_%MM%
SET FOLNAM1=%YYYY%%MM%%DD%for /f %%i in (j:\configfol.txt) do MD %%i\%FOLNAM%\%FOLNAM1%
::** CODE END
what i feel is that if i am able to run a if check inside the for loop i will be able to do itbut the problem is i dont know how to do it
Please help
ThanksGaurav

This should work:
(Depends about your os. Standalone Dos doesn`t know the for /f statement.)for /f %%i in (j:\configfol.txt) do call :SUB
%%i
:SUB %%i
if not exist %1\%FOLNAM%\%FOLNAM1%
MD %1\%FOLNAM%\%FOLNAM1%
The MD... line is the same as the if statement.
Computing net breaks the lines.hope it helps
uli

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |