Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have a Backup folder called cod5profiles with over 500 folders in it.
Each of the folders should only have 1 folder in it called $$$, contaning data i need to keep, there is also a text file called active.txt and a file called myreg.key in the backup folder too (not in the $$$ folder)
Due to a mistake on my part many of the folders now have copies of the other 300 folders in them.
Could someone help me with a batch file that will clean out the folders, ie remove any folders that are not called $$$ in each backup folder.
All the backup folders have diferent names but end in cod5, eg:
smithacod5
jonesbcod5any help would be wonderful
Thank you
Mac

Hi Mac
Run this above the folder cod5profiles
hence "cd cod5profiles".
Change "rd /s /q "%%b" when happy
as this will not ask for confirmation.@echo off
cd cod5profiles
for /D %%a in (*.*) do (
echo Directory %%a
cd %%a
for /D %%b in (*.*) do (
if not "%%b" EQU "$$$" rd /s "%%b"
)
cd..
)
cd..

Thank you so very much. You talented guys are the boys!
That little batch saved me a good hour+
Kindest regards
Mac

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |