Batch delete certain files only certain file exist in subfolder
Posted: 06 Sep 2017 11:35
I just want a batch file to delete all files with extension *.P3? in all subfolders on condition of only some file exist in these subfolders like *.pkg file
for example:
C:\test\abc\*.P3A
C:\test\abc\*.pkg
C:\test\def\*.P3L
C:\test\ghi\*.P3P
C:\test\ghi\*.pkg
So the batch run results should be as below: both the *.P3A file in abc folder and *.P3P file in ghi folder should be deleted. But the *.P3L file should not be deleted since it does not have *.pkg file in folder of def.
Thanks
for example:
C:\test\abc\*.P3A
C:\test\abc\*.pkg
C:\test\def\*.P3L
C:\test\ghi\*.P3P
C:\test\ghi\*.pkg
So the batch run results should be as below: both the *.P3A file in abc folder and *.P3P file in ghi folder should be deleted. But the *.P3L file should not be deleted since it does not have *.pkg file in folder of def.
Thanks