2

Run-down

1: We need to copy files from one folder into another folder - Folder A -> Folder B (while preserving subfolder structure)

2: Some of the files in Folder A are IDENTICAL to files in Folder B

2a: IDENTICAL: Files that are identical in name, size, date created, date modified.

3: Some of the files in Folder A are SIMILAR

3a: SIMILAR: Files which have identical names but are not identical in size, or date

4: The goal is to move files from Folder A into Folder B.

o We want to:

OVERWRITE: IDENTICAL files

COPY But Keep Both Files (rename): DUPLICATE files, according to a naming standard (filename_01).

• Preserve folder structure so files in A subfolders are copied into same B subfolders. (ie. Folder A\subfolder1\filesname.exe is copied to B\subfolder1\filename.exe)

The current plan is to use Robocopy (with GUI), can this be done? What switches should I look at using? If this cannot be done with Robocopy is there another software I should look at?

  • I'm currently looking into using the command **robocopy "FOLDER A"\ "FOLDER B"\ /xo /is /e /log:logfile.txt /v** But I'm not 100% sure this is going to do what I want (compare file attributes and take actions based on them). Doing this in multiple passes is not an option we're looking at 15K files here in various folders. I don't want to go through all 15K files and separate which ones are newer than similar files in destination and which ones can be overwritten. – Karl Is Wright Aug 24 '15 at 21:36

1 Answers1

3

Nothing beats a readthrough of the Robocopy documentation.

To cover all your objectives using Robocopy I am fairly certain you would need to stage the files in some way first. Such as identifying files which should not be overwritten and being creative in either setting/unsetting some attribute, or appending/prepending a string to the filename, either of which robocopy could identify and act upon. And so on. So multiple passes would be a consequence of choosing Robocopy I believe.

By the sound of your description, are you sure you are not really looking for a backup tool (such as rdiff-backup just to name one possibility) or a custom scripted solution instead of a plain file copy tool?

The question that lingers is why you have a requirement to overwrite identical files where you could simply do a full copy, then incrementally copy changes whilst preserving history (in the manner most desirable for you)?

ErikE
  • 4,676
  • 1
  • 19
  • 25
  • Thanks for the reply, I haven't heard of rdiff-backup before. I was just about to look into rsync myself. Regarding the Robocopy documentation, while I was able to find a parameter /e that would preserve files structure, I didn't find any switches that would compare attributes and do what we wanted to do with them. – Karl Is Wright Aug 24 '15 at 21:31
  • rdiff-backup is like rsync with a time travel option. – ErikE Aug 24 '15 at 21:36
  • 1
    I don't have to overwrite files that are identical, I just figured it'd be easier. the alternative of going back and looking at what wasn't copied and then separating the wheat from the chaff is going to be daunting because we're looking at over 15K files. So even if only 7K are left, that's still an awful lot. – Karl Is Wright Aug 24 '15 at 21:39
  • Robocopy isn't really a perfect match, wonderfully effective as it is. rdiff-backup is right there and my favourite for stability and simplicity when maintaining history in a form accessible through normal file system tools. Stable too. But other people here have other favourites with similar capabilities, if you search serverfault a bit I'm sure you'll find good other alternatives to robocopy and self scripted solutions. – ErikE Aug 24 '15 at 21:50