Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We copied all our files to a new storage server recently. We didn't want to move at the time because we weren't sure if files would get lost.

The problem now is that we have files on both places.

How can we move only the files that do not exist in the target and for those that exist in both places we delete it from the source? It is Windows Server 2008.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

Use a compare tool like Beyond Compare. It can compare folders and shows you what files exist and don't exit in the folders and subfolders. Also, it shows if there are any differences between files that exist on both locations. beyond compare can also copy and/or move files from one folder to another.

share|improve this answer
    
I ended up using this as I could easily do this step by step! –  Oskar Kjellin Mar 19 '10 at 10:14
robocopy OLDDIR NEWDIR /S /XO

This leaves newer files in NEWDIR alone. Files in NEWDIR that are the same or older will get overwritten.

robocopy OLDDIR NEWDIR /MIR /XO

This does something similar - watch out for extra file deletion on this one.

The semantics of the /XO command are backwards.

I just set up a set of source and destination directories and proved it to myself, as no documentation explains the true meaning of "Exclude Newer". Newer what? Newer source? Newer destination? What?

PROOF:

  1. Do the copy.

  2. Edit a file in NEWDIR giving it a new time stamp.

  3. Do the copy again using /XO. The new time stamp on the file in NEWDIR remains.

  4. Do the copy again using /XN. The new time stamp on the file in NEWDIR reverts.

share|improve this answer

Use the robocopy tool with the /xn switch. I believe Server 2008 comes with robocopy as standard now.

/XC :: eXclude Changed files.

/XN :: eXclude Newer files.

/XO :: eXclude Older files.

/XX :: eXclude eXtra files and directories.

/XL :: eXclude Lonely files and directories.

/MOV :: MOVe files (delete from source after copying).

/MOVE :: MOVE files AND dirs (delete from source after copying).

so the command will be something like

robocopy OLDDIR NEWDIR /MOVE /XN

this will move over all the old files but wont overwrite new ones

You can always use the /L switch to do a dry run this will show you what will happen without actually do anything. Some things may be different on 2008, I am using the XP version.

share|improve this answer
    
After testing a little it seems that when files are newer on the dest than the source it puts them as older? So maybe XO? –  Oskar Kjellin Mar 19 '10 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.