copy entire mac directory to SMB share & suppress errors ?

djbeta

Registered
Hi there,

I'm a Unix newbie, and want to copy a big mac directory to a PC smb share.
The problem I'm running into is that the smb share will not allow certain filenames and the copy fails if I try to do it from the finder.

Is there some Unix command I can run that will copy the entire directory in such a way that it copies everything it can, and skips those that it can't copy, while at the same time not stopping every time it hits a file it can't copy?

there are thousands upon thousands of files and many many subfolders in this directory, so I want it to be as quick and painless as possible. I can live without copying the few files that have a filename problem.

Any help you could provide would be great.

thanks :)
 
Try:

rsync -az /Your/Big/Mac/Directory/ /Volumes/Mounted/SMB/Share/Some_Folder/

It will spit out the names of anything it has a problem with but should march on to the end. If you use the "-n" flag it will show you what gets copied and what causes errors without actually copying anything, a handy diagnostic which will obviously run quicker than actually copying all the files:

rsync -azvn /Your/Big/Mac/Directory/ /Volumes/Mounted/SMB/Share/Some_Folder/
 
thank you!

I tried that and this happened mid-way through:

Code:
RTDB:~ security$ sudo rsync -az /Users/rtdb/ /Volumes/research\%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/
Password:
symlink "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Ackley, Brian/iDVD.app/Contents/Frameworks/Oxygene.framework/Oxygene" -> "Versions/Current/Oxygene" failed: Operation not supported
symlink "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Ackley, Brian/iDVD.app/Contents/Frameworks/Oxygene.framework/Resources" -> "Versions/Current/Resources" failed: Operation not supported
symlink "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Ackley, Brian/iDVD.app/Contents/Frameworks/Oxygene.framework/Versions/Current" -> "A" failed: Operation not supported
symlink "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Ackley, Brian/iDVD.app/Contents/Frameworks/OxygeneLayers.framework/OxygeneLayers" -> "Versions/Current/OxygeneLayers" failed: Operation not supported
symlink "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Ackley, Brian/iDVD.app/Contents/Frameworks/OxygeneLayers.framework/Resources" -> "Versions/Current/Resources" failed: Operation not supported
symlink "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Ackley, Brian/iDVD.app/Contents/Frameworks/OxygeneLayers.framework/Versions/Current" -> "A" failed: Operation not supported
mkstemp "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Feinstein, Paul/Paul_Feinstein_pdf_files/Organized_by_Journal/.Cell_2004a_*1st_.pdf.2jlaOR" failed: No such file or directory
mkstemp "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Feinstein, Paul/Paul_Feinstein_pdf_files/Organized_by_Journal/.Cell_2004b_*1st_.pdf.0jCqSN" failed: No such file or directory
Invalid checksum length 13041664
rsync error: protocol incompatibility (code 2) at /SourceCache/rsync/rsync-14/rsync/sender.c(50)
rsync: writefd_unbuffered failed to write 103 bytes: phase "unknown": Broken pipe
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-14/rsync/io.c(836)
RTDB:~ security$
I think it might have been because a file it's getting to has permissions of another user (that's why I ran the sudo before the command).. does it seem like that could be the problem? If so, is there a way I can make it so that it does not stumble over files that are owned by other users?

thanks for the help
 
The 'sudo' should take care of permissions. Looks like the fatal error might come from the two files it reports as "missing":

Code:
mkstemp "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Feinstein, Paul/Paul_Feinstein_pdf_files/Organized_by_Journal/.Cell_2004a_*1st_.pdf.2jlaOR" failed: No such file or directory
mkstemp "/Volumes/research%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/Application_Material/DB/z__2004-2005_archive/2004-2005/Feinstein, Paul/Paul_Feinstein_pdf_files/Organized_by_Journal/.Cell_2004b_*1st_.pdf.0jCqSN" failed: No such file or directory
Try running the command again with an exlude pattern to omit those:

Code:
sudo rsync -az --exclude='.Cell_2004*.pdf.*' /Users/rtdb/ /Volumes/research\%20training/STEVEN/TECHSTUFF/Backup/RTDB_BACKUP/
You'll know pretty quick if there's a problem since rsync will pick up where it left off the last time.
 
Thank you! this did help.. however I ran into another file I need to exclude.. how can I add another string that I want to exclude ?? (also, is there some mac utility that can effectively delete hard-to-delete items that are corrupted or just acting plain weird)? thanks :)
 
You can provide multiple '--exclude=' arguments:

Code:
sudo rsync -az --exclude='.Cell_2004*.pdf.*' --exclude='.Nature_2003*.pdf.*'  /Path/To/Source/ /Path/To/Destination/
As for effectively deleting files, I'm sure there's some utils out there but to be honest a good old "sudo rm" does the trick for me...
 
Back
Top