Hello I want to make a batch that deletes these folders and all their contents:
C:\found.000\, C:\found.001\, C:\found.002\, etc
or more accurately %systemdrive%\found.000
So far I have this:
for /d %%X in (found.0*) do rd /a /f /s /q "%%X"
However, this only does it if the current directory is C:\
I've tried playing around with adding the directory but it only seems to work when when the current directory is set to certain folders.
Can anyone make a better solution? Ideally I want:
Delete all folders in %systemdrive% containing found.0*
Thanks in advance
Delete all folders containing a string
Moderator: DosItHelp
Re: Delete all folders containing a string
hi,
i used the line given by you,
the complete code was
@echo off
for /D /R %%i in (*.*) do (
cd %%i
for /d %%X in (found.0*) do rd /s /q "%%X"
cd ..
)
cd..
@echo on
save this in c:/abc/
it will delete all the directories in this directory,
run this file where ever u want do delete
thank you
i used the line given by you,
the complete code was
@echo off
for /D /R %%i in (*.*) do (
cd %%i
for /d %%X in (found.0*) do rd /s /q "%%X"
cd ..
)
cd..
@echo on
save this in c:/abc/
it will delete all the directories in this directory,
run this file where ever u want do delete
thank you
Re: Delete all folders containing a string
you are welcome