Site TIPS PAGE🔎   UP ONE LEVEL
 OJB's Web Site. V 2.1.tip tips mac owen2 
Tip

Up to OJB's Mac Tips List

Copy Files with Errors

If the Finder (Mac Desktop) encounters an error while copying files it "gives up". The damaged file isn't copied, even if some part of it can be read, and any other files which should have copied after the damaged one are abandoned.

Sometimes it is useful to copy a file as much as possible, even if some of it is damaged. For example, a photo might mostly copy but have a black band near the bottom, or a word processing file might be mostly intact, but have some "junk text" in the middle.

It would be great if we could just click a button on the Finder's error screen and say "Copy as much as possible", or something similar, but we don't have that option. Luckily, as is often the case on the Mac, we have the Terminal!

Start Terminal and use the "dd" command to copy the files as well as possible. If the file is damaged there's a good chance the disk (or flash drive, SD card, etc) is damaged, so copy the file onto another disk, and stop using that disk.

Here's the basic format...
dd if=/Volumes/DISKNAME/FILENAME of=/FOLDERNAME/NEWFILENAME conv=noerror,sync

Where if= specifies the input file (damaged file to read).
And of= specifies where to write the new file to.
And conv=noerror,sync specifies to continue when errors are encountered.
And DISKNAME is the name of the disk to copy from.
And FILENAME is the name of the damaged file (including suffix, like "docx").
And FOLDERNAME is the complete path to the folder to copy to.
Note: the complete path might be something like /Users/YOURNAME/Desktop.
And NEWFILENAME is the name for the new file (including suffix).

Here's an example...
dd if=/Volumes/Files/Test.jpg of=/Users/ojb/Desktop/Test2.jpg conv=noerror,sync

This reads a damaged file called "Test.jpg" which is on a disk (flash drive, SD card, etc) called "Files" and writes as much as possible to a file called "Test2.jpg" on the desktop of the user called "ojb".

Note that, in general, the suffix of the file being read and written should be the same.

Also note that there is no guarantee the file will be useful. It really depends on how much of it can be read, and if any critical parts are unreadable. If it crashes the program you try to open it with, try a different one. For example, if Word won't open one of its documents, try Pages instead.

As I said, there are no guarantees with this method, but it's better than nothing!



My latest blog post: Avoid Microsoft: If you don't really like computers much you could make things a bit better for yourself. (posted 2024-12-04). My latest podcast: OJB's Podcast 2024-11-18 Unity Through Division.
 ©2024 by OJBBlogMacs are BestMac Made
T: 10. H: 193,000,710
Features: RSS Feeds Feedback LogMod: 07 Jun 2024