robocopy options to ignore OSX invisible files, or, dot_clean first?

3

I'm trying to copy ~8GB of files from a USB stick to a win7 system. The files on the USB stick appear to be coming from an OSX system (.DS_Store files and corresponding ._filenames for each file). For what it is worth, the USB stick is formatted FAT32.

The main directory contains seven subdirectories with a total of 250+ subdirs and there is a total of some 2500+ files. When I drag and drop copy I get a "Destination Path Too Long" error msg:

Destination Path Too Long

When I use the cp command, I get similar PathTooLongException error messages (notably, more of them...?)

Using the robocopy command and the /e option, I am able to successfully copy all the files without error:

robocopy G:\SOURCE_FOLDER C:\Users\user\Desktop\DESTINATION_FOLDER /e

Is there a way to copy all the files with robocopy but to exclude the ._ "meta" files and .DS_Store files? Or is it better to simply recursively delete them? After doing some more research, would it be a better idea to dot_clean the files before copying them to a windows system? Thanks!

Mr. Kennedy

Posted 2016-10-14T05:22:08.703

Reputation: 635

Answers

3

You can use Robocopy with the /XA:SH and the /XD *. flags to exclude hidden folder and files which should keep the dot files from being copied over.

hiiambo

Posted 2016-10-14T05:22:08.703

Reputation: 289

@hiambo nice - had to look up what the RASHCNETO file attributes were... If I am reading that right /XA:SH eXcludes Attributes that are System and Hidden and /XD *. eXcludes Directories that end in a period - shouldn't that be .*?

– Mr. Kennedy – 2016-10-14T17:33:46.520

I didn't have the ability to test and it was late after a 12 hour day at work so you might be right. My notes say *. but they may be wrong. – hiiambo – 2016-10-14T19:24:15.490

Thanks, Bo :) I used the command with the /XD *. option and it seems to have worked just fine (tho I didn't test a robocopy with /XD .*...) Am I correct in reading the powershell syntax that /XD *. is eXcluding Directories whose names end with a period? – Mr. Kennedy – 2016-10-15T01:53:55.487

1The "*" effectively stands for the path up to such folders. – hiiambo – 2016-10-15T21:05:39.993