Window Batch file to keep some specific folders and delete the rest

60 views Asked by At

I have 100+ folders, and I want to run a batch file to keep certain folders like 10 folders with different names based on my list. Example I have folders like

1FL-12
1FL-44
1FL-86
2FL-95
2FL-73
2FL-25
3FL-52
4FL-53
4FL-35
5FL-85

I am trying to keep only the folder 2FL-95, 2FL-73 and 2FL-25 and delete the rest. Before I tried using rmdir /S /Q "C:\pathtodirectory" to delete the unwanted ones but its not that convenient when there are just too many folders to delete.

Is there any simpler way to keep only the folders and delete the rest?

0

There are 0 answers