Friday 27 March 2015

Mac: How to ignore files with errors when copying

When copying files on a Mac using Finder, the copy operation will be interrupted if a file with errors is detected, which makes sense in many cases. However, in some cases you just want to copy "what you can get", and ignore invalid files. This can be done using the "cp" command in terminal, as described here.

Use the following syntax in terminal:

cp -Rp SourceFolder DestinationFolder

The -R flag will ensure that the copy operation is continued even if there are errors. The destination folder does not have to exist, you can specify a new folder name and it will be created.