Wednesday, November 22, 2017

Error copying .CR2 files from memory card - "The finder can't complete the operation because some data in..."

I mostly copy all my photos to external drive and later have a look at them. The copying files from CF card of new Canon M-IV to my macbook pro in the Finder takes place using CMD+C in the card directory and pasting to my external drive using CMD+V. I have been using RAW files for many years, and doing this copying process many times I never had an issue. But recently, this error poped-in saying:
"The finder can't complete the operation because some data in can't be read or written. (Error code-36)" 
After this message, copying stops.

My thought was that some files got corrupted.so I shall still copy other files that are not. I started to copy files individually and realised that there are lot of files which cannot be copied.
While looking at those .CR2 files which cannot be copied, I realised their previews were totally dark or half of the photo with random patterns.  This observation brought an attention to the fact that none of the uncopyable files had previews, but has a normal large file size (20mb to 35mb) for RAW files from new DSLRs. This happened because there were many files and it takes sometimes for Finder to read the contents and possibly create previews for each file. For some reason, it could not copy these files without knowing the contents?!?!?
Anyways, what I planned was to make a copy of rest of the files without stopping in case of error.
My option was to use Terminal, and use -Rp option to copy the folder from CF card to external drive. Reading man page of cp,:

Using following command did the trick: 
cp -Rp "/Volumes/< source Volume name > / < source folder name >/" "/Volumes/< destination Volume name >/< destination folder name > /"

One easy way to easily put folder location would be to drag the corresponding folder while writing source and destination folder address, For example, type cp-Rp, space, drag source folder to Terminal, the press space, and drag and drop the destination folder. Press Enter.

This command starts the slow but good process of copying files with their original atributes and cotinue copying even if there is an error. After sometimes the command ended with error mentioning that two (named) files were not copied. I changed the command and tried this:
cp -Rp "/Volumes///                                                                                                                                                                " "/Volumes//"
cp -Rp "/Volumes/< source Volume name > / < source folder name >/ **" "/Volumes/< destination Volume name >/< destination folder name > /"

With that, I was able to copy all the files. Just out of curiosity, I tried to copy the whole folder to new location and it did copy it smoothly without error. This means that the time I was copying the files using terminal, Finder had managed to create a preview of all the files and thus copy went without error.

I hope that this process will help others as well. Let me know if you have similar experience and your solution for this issue,