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!

1 Answer 1

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.

4
  • 1
    @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 .*?
    – MmmHmm
    Commented Oct 14, 2016 at 17:33
  • 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
    Commented Oct 14, 2016 at 19:24
  • 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?
    – MmmHmm
    Commented Oct 15, 2016 at 1:53
  • 1
    The "*" effectively stands for the path up to such folders.
    – hiiambo
    Commented Oct 15, 2016 at 21:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .