Re: batch file help


Go Back   Computer Help Articles > Windows XP Security Admin
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-05-2006, 04:15 AM
cquirke (MVP Windows shell/user)
 
Posts: n/a
Default Re: batch file help

On Fri, 14 Oct 2005 03:07:01 -0700, "james"

>I am trying to write a batch file that takes as an arquemant a directory to
>look for, searches the current directory and all sub directories for a
>directory of that name and deletes each one it finds.
>The command that I am using is


>FOR /F %%i IN ('dir /b /s /ad %1*') DO rd %%i


>and the problem is that if I have a directory structure say dir\dir the
>script deletes the sub directoryvand not the top level dir.


You may be up against the bottom-up way /F processes subtrees.

One way might be to expand the For statement to Set a variable when a
match is found, and then loop to re-run the entire For statement until
this variable is no longer Set. Messy if applied to laaarge subtrees.



>--------------- ---- --- -- - - - -

I'm baaaack!
>--------------- ---- --- -- - - - -

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with old SUS client Remy G. Windows Update 2 01-05-2006 05:20 PM
Hijack problem Tom B. Windows XP Security Admin 7 01-05-2006 05:44 AM
Need help fixing virus omi Windows XP Security Admin 6 01-05-2006 05:44 AM
EGroup.IEAccess.C (dialer) dtcar Windows XP Help and Support 22 01-05-2006 02:41 AM
USB Mass Storage Device - This device cannot start. (Code 10) lobo201 Windows XP Hardware 11 01-05-2006 02:15 AM


All times are GMT. The time now is 02:04 AM.


Powered by vBulletin Version 3.5.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. SEO by vBSEO 2.3.2 © 2005, Crawlability, Inc.

Re: batch file help