“No To All” – and XCopy

So, you use Xcopy to backup the contents of one hard drive onto another, new, hard drive. It’s gonna take a while and you leave it running.

Xcopy  /s  /c <source>\*.*

When you return you find there was a power outage (or, in my case, I missed one of the power management settings that the stupid computer decided to invoke).

How do you restart copying ? You could run the same command again but now you will be prompted on every file that had already and simply saying yes-to-all means re-copying the same files again – in my case that’d waste at least 6 hours.

What you want is to be able to say “no to all” when asked if you wan’t to over-write but alas like so many programs no-one seems to ever supply this as an option.

Fortunately there is non-obvious solution for XCopy – add the /D option which

Copies files changed on or after the specified date.If no date is given, copies only those files whose source time is newer than the destination time.

Since any previously copied file will have a matching date time the file will not be over-written.

That was lucky, but I’ve used other command line utilities in the past where I’ve wanted a “no-to-all” and couldn’t find an obvious workaround. Until I tripped over this link which had one solution that made be laugh. Simply create a text file full of “n” characters, each followed carriage return (you could knock up a quickie app to do this in 5 mins – 4 mins for Visual Studio to start up (why is it so slow these days) and 1 minute to write/compile/run). Then simply pipe that text file into the offending command line app, for example if there hadn’t been another option for XCopy then:

Xcopy  /s  /c <source>\*.*  <MyTextFileFullOfNs.Txt

Funny ? Well, yes ! But it’d get the job done when no other solutions were forthcoming.

2 comments

  1. There’s a easy way of doind so:

    echo n | xcopy /s /c

Leave a Reply