Force file copy on Mac

1namyln
1namyln used Ask the Experts™
on
I have a Western Digital my book that was attached to the network.  The ethernet and usb component of this device has failed.  I removed the drive and attached it via a usb adapter and through a USB Fedora key I was able to see and copy the files.  The problem I'm having now is when copying the files back to the reformatted WD drive the copy fails stating a file already exist.  Duplicating or skipping the file would be fine by me but the copy simply stops.  There are too many files to surgically copy.  I'd like to force the copy some way with whatever program necessary.   I've read some things about 'ditto' command in terminal but don't really understand how to.  My Mac OS is 10.7.5  Thanks in advance.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Cloud Architect
Commented:
You could take a look at rsync ... It should be available in both Linux and Mac...

Something like this might do the trick:

rsync -a /source/dir /destination/dir --ignore-errors

Open in new window


There's a bunch more optional triggers you can add ... You'll need to test out what works best maybe.

Author

Commented:
Thanks!  I'm having issues with my syntax though.  For example I have typed the below:

rsync -a '/Storage/Clients/Christia D/Public' '/Daniel Storage/' --ignore-errors  Tried many variations to no avail.

Using the ' when I have spaces in file names.
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
What issues do you have when you try
rsync -a '/Storage/Clients/Christia D/Public' '/Daniel Storage/' --ignore-errors

Author

Commented:
The problem now is they are on different disk and I don't know what to type to specify the different disk. I e on does c:\ d:\ etc.
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
If the disk is mounted, the path should be sufficient.
Do you see the disk on df?

Author

Commented:
So the path would be whatever the drive name is etc?  I e /storage/ Christi  /destination drive/
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
Is the disk mounted?
If not, how are you getting to it?
What command did you use when you got a file already exist error?

Author

Commented:
The disk are mounted. What I'm saying is I don't know what syntax to use to specify the disk in question.
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
If it is mounted, it should have a path.   Perhaps under /Volumes
Where did you mount it?
What do you see in `df`?
What command did you use when you got the file already exist error that you mentioned earlier?
How have you been getting to the disk?

Author

Commented:
I'm accessing the drives via finder on my Mac.  I don't understand the question of where their mounted to.

Not adding /Volumes was getting me.  I'm now using rsync -a /Volumes/Storage/cf/daniels/Public  /Storage/ --ignore-errors

It appears to be working...sort of.  In terminal I'm seeing a lot of things stating xxxxxxxfile has vanished and its referring to thumbnail images that were from the iPhoto cache.  Gonna let it run a while and see what happens.

Author

Commented:
Forgot to add /Volume to the destination.  Working OK so far...

Author

Commented:
I understand why there were so many duplicates now.  The device was using some sort of wannabe raid array.  On the same drive though!?  Odd.

Author

Commented:
Its failed again.  I received the below in terminal:

rsync warning: some files vanished before they could be transferred (code 24) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]

Then it stopped.  Copied about 2GB of the 40GB.

Author

Commented:
The source drive is formatted in NTFS.  Maybe this is causing my issues.  I've installed NTFS-3G and trying copy again...
Zephyr ICTCloud Architect
Commented:
rsync warning: some files vanished before they could be transferred (code 24) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]

This error can somewhat be ignored, depending on circumstances, the error basically means that rsync builds a list of files at the start, so the message or error you're seeing is telling us that from the time the rsync command built the initial list to the time when it was copying the actual file, the file disappeared or wasn't accessible anymore or something of that nature...

Normally it shouldn't stop, but if it really can't find the files anymore then it hasn't got anything to copy so it stops ...

Now to find the reason why it's happening, that will be another thing.

It could be about the NTFS format, it could be (user)rights on the files on that disk ...

You could try copying only partial folders, something like:

rsync -avr /Volumes/Storage/cf/daniels/Public/Documents/  /Storage/  --ignore-errors

Open in new window


The syntax "-avr" will be better than just "-a" and probably, hopefully copy more ...
"-v" will produce more information on your screen, which will maybe become handy for further troubleshooting.

Author

Commented:
What a nightmare this has been.  I ended up copying 5 folders at a time and manually navigating the duplicated files.  Thanks for your efforts.

Author

Commented:
I will be using rsync in the future.  A recent convert to Mac going on about a year.  Terminal is very powerful.  Thanks again!
Zephyr ICTCloud Architect

Commented:
No problem, glad you found it helpful!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial