In my C# application, I am using robocopy for with option /s for copying sub folders also.

Suppose I have files & folders from the last month.

Which file will it copy first, the latest one or the older one?

Is there any way that we can specify that it should copy the old file first or vice versa?

link|improve this question
I'd expect it to just go alphabetically... and why does it matter which order files are copied in anyways? – Robert Rouhani Jan 13 at 8:02
if problem occurs to my aap...it should copy the latest file first – user373083 Jan 13 at 8:04
Alphabetically... or anyway you can't relay on what it copies first or last. Also support Robert, why does it matter? – Regfor Jan 13 at 8:04
it matters to my app....thats why i want know.....& know if is there any option with that i can control it? – user373083 Jan 13 at 8:08
What type of problem? If you're going to copy an entire subdirectory tree, the entire tree will be copied once the command is done anyways. If you want to only copy specific files you'll have to do it manually. – Robert Rouhani Jan 13 at 8:09
show 1 more comment
feedback

migrated from stackoverflow.com Jan 13 at 23:55

This question came from our site for professional and enthusiast programmers.

1 Answer

robocopy will copy the files and directories first, that it first gets from the OS. If you want a specific order - you have to take care of that:

  • list your files
  • order them by date
  • call robocopy for each file

that should solve your problem.

link|improve this answer
if i ordering them by date....which files or directories it takes first the latest ones or the older ones? I want my recent my recent file or directories to be copied first...what can i do? – user373083 Jan 13 at 8:20
1  
depends on how you order them - the ordering algorithm should be implemented by you - so you do a bubblesort, quicksort, etc. on the last-modification date. here you can find an implementation of a bubblesort: codecodex.com/wiki/Bubble_sort – Gambrinus Jan 13 at 9:56
feedback

Your Answer

 
or
required, but never shown