Re: Looping through Directories...

From: Paul R. Sadowski (xpert_at_mailshell13.mailshell.com)
Date: 05/14/04


Date: Thu, 13 May 2004 23:45:07 -0400

Test it, then change the echo lines to
  md "%%c\Newdir1"
  md "%%c\Newdir2"
replacing Newdir1 & Newdir2 with the directory names you want to use.

@echo off
for /f "tokens=*" %%c in ('dir /s/b/a:d %~dp0') do (
  echo %%c\Newdir1
  echo %%c\Newdir2
)

"Holden Caulfield" <commanderblop@hotmail.com> wrote in message
news:6d0ce83a.0405131914.79dc5fda@posting.google.com...
> Hi there!
> I need a working batch file that:
>
> 1.Takes the current directory it is run from and loops through each
> exisiting folder
> 2.in doing so creates 2 new subdirectories in each existing directory
>
> So, if I run the batch file in c:/apples, which has these
> subdirectories, grannysmith, macinstosh and golden_delish, 2
> subdirectories are created in each of the apple types.
>
> That's It!
> (But just in case you want more info, here it is...)
>
> Background: I am using a PNG to JPG converter to literally convert
> thousands of PNGs to JPGs in thousands of different directories, and
> need to automate the process. The images are converted and saved into
> 2 subdirectories because they are resized to two different sizes as
> well.
>
> I know I want to sort of combine a DIR command with a FOR LOOP
> command, and then create the subdirs (and run my command line
> converter), but I don't know how toprogram batch files that well, and
> I need to get this thing done ASAP. I searched for the last two hours
> on a resource that does this (I think) simple requirement, but to no
> avail.
>
> I appreciate any and all help. Especially a working batch file! ;)
>
> Thanks,
> Holden



Relevant Pages