/IS switch not working as intended (1 Viewer)

conception_native_0123

Well-known member
Local time
Today, 04:25
Joined
Mar 13, 2021
Messages
1,826
arnelgp help me with this not too long ago. but it is not working the way i want. here is my file now

Code:
@echo off
echo Overwriting files in [C:\Users\u\2] and all its subdirectories...
robocopy "C:\Users\u\1" "C:\Users\u\2 /E /IS
exit
i have many files in C:\Users\u\1 that have newed modified dates than they have in u\2. the same file names are in both. but files are not being overwritten in any subfolder below u\2. just files in "u\2" top level directory being overwritten. "E" switch causes ALL files in all subfolders from u\1 to overwrite equivalents in u\2, but i do not want this. only overwrite files into u\2 that have newer date modified stamps. /IS switch is supposed to do this is it? i am lost. what am i supposed to do? thanks.

this is my other thread where i learned the /IS switch.

 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:25
Joined
Feb 28, 2001
Messages
26,996
Here is a link to the description of ROBOCOPY


The description of selection option /IS does not match what you described here. The /IS option is meant to include copying files with the same name, type, size, times, and all attributes. That is, it would explicitly overwrite files that probably DON'T need to be overwritten because they are already the same. (/IS = "include same")

I'm thinking from your description ("only overwrite files into u\2 that have newer date modified stamps") that MAYBE you really wanted the /XN (/XN="exclude newer") option, which would exclude existing files if the destination copy is newer than the source. At least that is how I read it.
 

conception_native_0123

Well-known member
Local time
Today, 04:25
Joined
Mar 13, 2021
Messages
1,826
I'm thinking from your description ("only overwrite files into u\2 that have newer date modified stamps") that MAYBE you really wanted the /XN (/XN="exclude newer") option, which would exclude existing files if the destination copy is newer than the source. At least that is how I read it.
doc man i do not think article is correct. this is what seemed to work for me

/xoExcludes existing files older than the copy in the source directory.

that make no sense. so, what it did is exactly what i wanted, but it INCLUDE newer files from the source and EXCLUDED older files from the source. so microsoft description of what it does make no sense. in my mind it should have said this


/xoCopies files from the source directory that are newer than files in the target directory.

it does not matter though because /XO is the solution apparently. thank you for the article. i just guessed the answer the first time because /XN copied files that had nothing to do with what I wanted. problem solved!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:25
Joined
Feb 28, 2001
Messages
26,996
So you are suggesting that the article is written incorrectly? Wish I could say that has never happened before, but the sad truth is that even MS has people writing their articles and people make misteaks. ;)

Glad to have helped. To be honest, that one was a new CMD verb for me, so I learned something as well.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:25
Joined
Feb 28, 2001
Messages
26,996
The day I have stopped learning, you should check my pulse to see if I still have one.
 

Users who are viewing this thread

Top Bottom