1

I have 2 hard drives, I copied everything from one hard drive to a fresh drive, but some files didn't copy as they were corrupted. Is there an easy way to check what files from one hard drive are not on another?

2
  • In my view, you should look into using rsync, and I think that rsync --update --list-only should do the trick, but I'm not sure. Either way, rsync does an awesome job. You may also want to look at rsyncbackup.vbs which some professionals created for free use because analysed commercial solutions were not satisfactory.
    – Run CMD
    Commented Nov 19, 2015 at 8:42
  • yea any of the sync softwares that have "compare" routines , windiff (microsoft) is really old simple small program that does compares, first scan takes forever, but learning how to use it one can re-scan, and copy what is different/wrong. Not made for mass file copying , more for syncing programing parts and pieces in a folder sub-folder set, but it works fine for it, given the time, and is checking every bit :-) of the files.
    – Psycogeek
    Commented Nov 19, 2015 at 9:30

2 Answers 2

3
robocopy sourcedriveletter: destinationdriveletter: /MIR /LOG:logfilename.txt /TEE /L

Robocopy is a command-line tool built into windows. You can check the options by opening a cmd prompt (for this purpose, probably as admin I suppose) and typing robocopy /? or robocopy /? > %USERPROFILE%\desktop\robocopyoptions.txt if you want a text file version of the help doc.

In my sample above, /MIR means "mirror" and it duplicates "source" in "destination," and deletes anything in "destination" that is not in "source."

/log: logs to a file, /TEE outputs to the console as well as the logfile.

The final command /L sets it to list only, and will not actually copy or delete files.

The log will very clearly show you which files in the source do not exist in the destination.

Of course, I strongly urge you to examine the help docs first to ensure my example is correct.

1
  • Thanks @Yorik this worked with the exact command line that you put at the top, but I did check just in case, accepted
    – Baibro
    Commented Nov 20, 2015 at 1:23
2

feedback from OP: excel method did not work for him, Matlab method is untested I have a very inelegant solution, but I think it does the job (assuming your have excel). It only works if the number of filenames fit in excel. (excel has a limited Max number of rows: 1,048,576).

Go to cmd (I'm assuming you are on windows). Change directory to the first drive. Type:

dir /s/b/o:gn > drive1.txt

Do the same for the second drive, but change the name of the txt file.

I took the cmd line from: https://stackoverflow.com/questions/3447503/how-to-get-a-list-of-sub-folders-and-their-files-ordered-by-folder-names .

Copy both outputs in excel(assuming 2007 or newer). The easiest option I know of is the following:

  • Select the columns that contain the cmd outputs.
  • On the data tab in the Sort & Filter group, click Advanced.
  • In the Advanced Filter dialog box, do one of the following:
    • To filter the range of cells or table in place, click Filter the list, in-place.
    • To copy the results of the filter to another location, do the following:
      • Click Copy to another location.
      • In the Copy to box, enter a cell reference.
  • Alternatively, click Collapse Dialog Button image to temporarily hide the dialog box, select a cell on the worksheet, and then press Expand Dialog Button image.
  • Select the Unique records only check box, and click OK.
  • The unique values from the selected range are copied to the new location. The original data is not affected.

This way you should have a list of all the unique filenames, which is the Same as a list of all the filenames that weren't copied.

The excel procedure was in the end taken from: https://support.office.com/en-us/article/Filter-for-unique-values-or-remove-duplicate-values-d6549cf0-357a-4acf-9df5-ca507915b704#bmfilter_for_unique_values

Alternatively you could use the cmd command in Matlab.

The command in Matlab could be:

DosCommand=sprintf('%s %s','dir /    B',directory);
    [status, cmdout]=dos(DosCommand);
end
Filenames = strread(cmdout,'%s'); 

Then execute:

NonCopiedFilenames = 

A(sum(bsxfun(@eq, A(:), A(:).'))==1);

The unique values trick was copied from: https://stackoverflow.com/questions/19236914/how-to-find-a-unique-value-in-a-matrix-by-using-matlab

3
  • 1
    If you don't have Excel there are free alternatives
    – Burgi
    Commented Nov 19, 2015 at 13:32
  • @BramMooij Sorry the excel method didnt work, I have thousands of rows of files and it crashes excel every time even with my good computer running on realtime
    – Baibro
    Commented Nov 20, 2015 at 1:11
  • Too bad. Is the number over 1,048,576? In that case it makes some sense since that is the limit of the number of rows in excel. In any case, I will add this limit to my suggested answer. Glad you found another solution though.
    – BramMooij
    Commented Nov 20, 2015 at 8:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .