Link to home
Start Free TrialLog in
Avatar of vrungel
vrungel

asked on

unix script to dos script

Hi guys,

What would be the equivalent of this unix command from a ksh script in a cmd script in DOS shell?

find . -type d -name blahblah -exec rm {} \;

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of NVRAM
NVRAM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vrungel
vrungel

ASKER

Thanks. My goal was to remove the directory and its contents. So the correct unix command would be

find . -type d -name blahblah -exec rm -Rf {} \;

Now, command dir /s/b/ad blahblah correctly finds directories I need, but I was wondering if it's possible to delete those directories and their contents (rd /s/q) on the fly rather than redirecting them to a list?

By the way, to supress the del confirmation, you need to use /q :)
>Now, command dir /s/b/ad blahblah correctly finds directories I need, but I was wondering if it's possible to delete those
>directories and their contents (rd /s/q) on the fly rather than redirecting them to a list?

Well, you could always install CygWin and the other GNU tools, and use:
   find . -type d -name blahblah -exec rm -rf {} \;
:-)  

But otherwise I don't know of a way without using the file.  Run "help for" (in a DOS shell) and check out the backquoted-command
syntax --it failed to work for me (on MS Windows XP Pro), but I didn't try too hard.  You might have better luck if you want.

>By the way, to supress the del confirmation, you need to use /q :)

I stared right at it (ran "del /?" twice) and still missed it.  Doh.