Reputation: 213
I am trying to process all the directory present in a given directory. However, i want to skip a particular set of directories and i know the names of these directory. Here's the pseudo code
for /D %%G in ("%ROOT_VAR%\mainDirectory\*") do (
if "%%G" == "%%ROOT_VAR%%\mainDirectory\dir_to_be_skipped" (
echo "Skipping dir_to_be_skipped"
)
continue processing other directory
How do i do that in batch script ? I just want to skip processing dir_to_be_skipped
Thank Kelly
Upvotes: 0
Views: 323
Reputation: 103447
Easy! Add an else
:
for /D %%G in ("%ROOT_VAR%\mainDirectory\*") do (
if "%%G" == "%%ROOT_VAR%%\mainDirectory\dir_to_be_skipped" (
echo "Skipping dir_to_be_skipped"
) else (
continue processing other directory
)
)
Note that the ) else (
must all be on the same line.
Upvotes: 1