Move unmatched files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Move unmatched files

#1 Post by drgt » 06 Jul 2012 15:06

Ok experts!

Files in Dir A:
1.000
2.000
3.000
4.000
5.000

Files in Dir B:
1.000
2.000
5.000

Batch file wanted to move 3.000, 4.000 (ALL files that are NOT the same as in dir B) from dir A to dir C.

Thanks

Aacini
Expert
Posts: 1932
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Move unmatched files

#2 Post by Aacini » 06 Jul 2012 17:23

Code: Select all

@echo off
cd DirA
for %%a in (*.*) do (
   if not exist "\DirB\%%a" (
      copy "%%a" \DirC
   )
)

Post Reply