Copying files - how to skip bad files and continuing to copy?

I'm currently trying to copy around 5TB of various files in many folders and subfolders. There seem to be some bad files amoungst them that are causing issues - as when Finder finds them it completely stops and shows an error message (compared to say Windows which would provide the option to skip the bad file and continue copying the rest). The problem with this is that if I start again Finder is very limited in it's options, it provides the option to Replace, Replace All or Don't Replace, if I hit Replace All, it starts from the begining again, if I click Don't Replace, it then does nothing, as the first level folders are all there, it doesn't seem to check that sub content within the folders are there...


Is there a method that I can set the Mac to transfer the data and skip over the files that it is unable to copy? I have little experience using Terminal (have only used it in the past following guides by copying and pasting the script into it), happy to give Terminal a go, but would require assistance with the correct script to use.

Posted on Sep 15, 2011 3:29 AM

Reply
8 replies

Sep 16, 2011 2:36 AM in response to twr7cx

twr7cx wrote:


I found the following at https://discussions.apple.com/thread/1462340?start=0&tstart=0 :

Niel wrote:


Once you've opened the Terminal, enter 'ditto' without the quote marks, drag the source folder or drive into the Terminal window, and then drag the destination folder into the Terminal window. Press Enter.


(31353)

That at least explains how to do it.


You have to insert a space after "ditto", so it should look like:


- enter 'ditto'

- hit the space

- drag the first folder from

- drag the folder to


ditto <folder-to-copy-from>/ <folder-to-copy-to>/

Sep 15, 2011 3:19 PM in response to Niel

Niel wrote:


Use the ditto Terminal command. For instructions, type 'man ditto' into the Terminal prompt


DITTO(1) BSD General Commands Manual DITTO(1)


NAME

ditto -- copy directory hierarchies, create and extract archives


SYNOPSIS

ditto [-v] [-V] [-X] [<options>] src ... dst_directory

ditto [-v] [-V] [<options>] src_file dst_file

ditto -c [-z | -j | -k] [-v] [-V] [-X] [<options>] src dst_archive

ditto -x [-z | -j | -k] [-v] [-V] [<options>] src_archive ...

dst_directory

ditto -h | --help


DESCRIPTION

In its first form, ditto copies one or more source files or directories

to a destination directory. If the destination directory does not exist

it will be created before the first source is copied. If the destination

directory already exists then the source directories are merged with the

previous contents of the destination.


In its second form, ditto copies a file to the supplied dst_file path-

name.


The next two forms reflect ditto's ability to create and extract ar-

chives. These archives can be either CPIO format (preferred for unix

content) or PKZip (for Windows compatibility). src_archive (and

dst_archive) can be the single character '-', causing ditto to read

(write) archive data from stdin (or to stdout, respectively).


ditto follows symbolic links provided as arguments but does not follow

any links as it traverses the source or destination hierarchies. ditto

overwrites existing files, symbolic links, and devices in the destination

when these are copied from a source. The resulting files, links, and

devices will have the same mode, access time, modification time, owner,

and group as the source items from which they are copied. Pipes, sock-

ets, and files with names beginning with .nfs or .afpDeleted will be

ignored. ditto does not modify the mode, owner, group, extended

attributes, or ACLs of existing directories in the destination. Files

and symbolic links cannot overwrite directories or vice-versa.


ditto can be used to "thin" Universal Mach-O binaries during a copy.

ditto can also copy files selectively based on the contents of a BOM

("Bill of Materials") file. ditto preserves file hard links (but not

directory hard links) present in the source directories and preserves

setuid and setgid modes when run as the superuser.


ditto will preserve resource forks and HFS meta-data information when

copying unless instructed otherwise using --norsrc . Similarly, ditto

will preserve extended attributes and Access Control Lists (ACLs) unless

--noextattr or --noacl is passed. DITTONORSRC can be set in the environ-

ment as an alias to --norsrc --noextattr --noacl on the command line.


OPTIONS

-h Print full usage.


-v Print a line of output to stderr for each source directory

copied.


It sounds like it does what I'm wanting to do from the description of it's first form (although no mention of an ability to skip bad files). But I can't see/don't understand what the command line would be that I would type to get it to do it!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Copying files - how to skip bad files and continuing to copy?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.