I have about 3GB of files/folders (47k files, 15k folders) on a server and am trying to copy it to another in the same domain via LAN. Every time I finish making a copy, the number of files being reported on the server being copied to is more than what exists in the original server.

I used Windows copy (using mouse) the first two times. I then used robocopy (first with the /E parameter and then with /E /PURGE). I have 47,619 files/15,335 folders on the original server. I have 47,640 files/15,335 folders on the copied server. The two times I ran robocopy with the said parameters did not change the number of files.

Does anyone what could be going wrong?

Other details:

  1. Both servers are Win Server SP1 Standard Ed.
  2. The server where the files are being copied to has 638 MB free in C: but I am copying everything to D: which has enough space.
  3. I am running the command sitting on the server where the files are being copied to.
  • Use WinDiff (or similar program) to compare the two directory trees. (Will WinDiff work with a LAN address, not sure?). If you uncheck the option to ignore identical files, you should be left with a listing of diffs. support.microsoft.com/kb/159214 (Later version of WinDiff are available.) – therube May 12 '11 at 23:52
  • Thx therube. Windiff seems to be a nice tool for instances like these. – Regmi May 13 '11 at 0:30

Copying with the mouse means that you probably used Windows Explorer to copy all those files. I've experienced many problems with this with large numbers of files that are stored within many directories where Windows Explorer copies files to the wrong directories.

This means that Windows Explorer probably copied some files to the wrong places, and now you have duplicates at the destination -- robocopy would just be ignoring those that it isn't overwriting, and that's how you'd end up with these duplicates.

To find the duplicates, use the following DOS command to output the directory structure to some text files (these operations will take quite a bit of time, so you can start them both in separate DOS windows then go have a coffee):

  • DIR /s /a /b [source-path] | SORT > file-listing-source.txt
  • DIR /s /a /b [target-path] | SORT > file-listing-target.txt

Then, edit those files with a search-and-replace to remove the leading portions of the paths that don't match. After that, compare the files with the following DOS command (this operation may take a while too, but shouldn't be as long as the first two because the sorting has already been done; go have another coffee but order a "small" size this time):

  • FC /a /l /n file-listing-source.txt file-listing-target.txt > file-listing-differences.txt

Then view the contents of "file-listing.txt" to see what's different.

(In total, only three new .txt file will be created.)

  • I used robocopy with "/E /PURGE" option which basically should delete anything that exists on the target folder if it does not exist on the source. Anyway, will do the directory comparision and see. And I used copy-paste initially to copy the main folder over from source to target. – Regmi May 12 '11 at 23:23
  • 1
    Followed your instructions. FC did not find anything. And then I logged on to the source server (rdp) and found that the count was correct there! All the while, I was sitting on the destination server, opening a window with something like "\\SourceServer\SourceDirectory", right clicking on the "SourceDirectory" to check the count and this way, it was giving the lesser count. This must be some bug with Windows. Thanks Randolf for your instructions which led to the discovery and the solution! – Regmi May 13 '11 at 0:29
  • @Regmi: You're welcome. I'm delighted that you took some extra time to describe how your problem got resolved -- thanks for doing that. – Randolf Richardson May 13 '11 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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