How do I look at files in two folders, and remove files in B not in A

Soldato
Joined
15 Nov 2003
Posts
14,417
Location
Marlow
All I want to do is automate a process so any files in directory B, not in A, are deleted. It must also go recursively down sub folders.

So do in to folder A & B below:-

Code:
A/
 file1.txt
 SUB/
  file2.txt

B/
 file1.txt
 file3.txt
 SUB/
  file2.txt
  file4.txt

file3.txt and filke4.txt would be removed.

I've tried writing my own DOS scripts, looked for apps, and have got no where :(
 
I think robocopy can do that with a purge command, test it out in another folder first though..

Please except a huge smacker on the lips!!! To think of the amount of time and effort I've wasted when this achieves it:-

ROBOCOPY source dest /PURGE /S

I suspected you guys would come through! Thanks!
 
Back
Top Bottom