Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

General discussion

Robocopy and Xcopy

Jan 2, 2011 9:21AM PST

I am trying to create another batch file that allows me to copy files from my User Directory (C:\Users\Username) to my External Hard Drive.

In Windows XP I had used the Xcopy Command which looked like this


xcopy "c:\documents and settings\Username\my documents\*.*" h:\backfiles /s/e/h/d/y
pause



However I cannot use this in Windows Vista because the Directory Structure is different and it containt system files like ntuser.data and Hidden Folders like AppData.

My Source is C:\Users\Username
My Destination is H:\backfiles


Can someone please show me the code how I can create an equivilant Xcopy Backup and an equivilant Robocopy Backup in Vista? (Equivilant to the backup in bold)

I think I may have some hidden files in my User Profile so I did not want to exlude hidden files. Can you please help.


Thanks

Discussion is locked

- Collapse -
Did you try the old switch sets?
Jan 2, 2011 9:24AM PST

Here's the two WORDS I use to remember the usual sets.

HICKORY
RICHKEYS

I don't think there is any equivilent from XP to Vista or 7. But you can try the old standby switches I use.
Bob

- Collapse -
Well
Jan 2, 2011 10:35AM PST

Thanks for your response.

Is there a backup I can create in Robocopy that will copy the whole directory (C:\Users\Username). So the size and amount of files of the source and destination mentioned above would be the same. But I don't want any files do be deleted from the source or destination even if I deliliberately delete files from the source? So can you show me the complete code for it please.

Thanks

- Collapse -
Sorry no.
Jan 2, 2011 11:27AM PST

At least I've never found a method while I was booted into that instance of Windows. The usual switches I use do save my files with a notable exception of my PST file if I had run Outlook prior to backup.

XCOPY sadly does not handle this job well at all but it does save my files that I want to save. I've never found saving those locked files of any use later.

Let's see if any member knows of a method that works when we have booted up this instance of windows and logged on.
Bob

- Collapse -
Oh Ok
Jan 2, 2011 1:25PM PST

Well Thanks for trying. I don't need to back up my PST file it is just the other Documents, Pictures folders etc.
Well do you know how I can add a switch to say "Press a key to continue" in Robocopy like Xcopy does when you use the 'pause' code a the end?

Why does Xcopy not handle this job in Vista when it did in XP using ?

xcopy "c:\documents and settings\Username\my documents\*.*" h:\backfiles /s/e/h/d/y
pause

The code above is what I want to do at least similar in vista

Thanks

- Collapse -
Sorry
Jan 2, 2011 1:39PM PST

But the switch sets I use are RICHKEYS and HICKORY and still work today. I'm sharing this to save me from typing out /R/I/C/H/K/E/Y/S since you are able to read which each switch does. I can make a backup of all the files that I can access. This will skip open or locked files but get the rest.

I have yet to find a backup that would do what you asked which was "So the size and amount of files of the source and destination mentioned above would be the same". The ONLY way to do that would have me boot either a PARALLEL WINDOWS INSTALL or Linux to do the copy but it appears to want a Windows solution (never found one.)

"But I don't want any files do be deleted from the source or destination even if I deliliberately delete files from the source? "

Which my sets of switches ALMOST does. If THIS.TXT is in the source it will overwrite the THIS.TXT in the backup effectively failing your requirement but I GUESS it was what you wanted.

Also, if THIS.TXT was deleted in the source, the copy in the destination would live on. So it seems my switches are close to what you want.
Bob

- Collapse -
Sorry I was not clear enough Thanks. However
Jan 2, 2011 1:57PM PST

Well would those two stitch sets copy all my personal files within C:\Users\Username including All files in Documents and all files and pictures as well as in music and so on.

Secondly if I used Robocopy which I heard is faster, How could I incorporate a switch such as the D Switch (with not date specified) in Xcopy which "Copies only the files whose source time is newer than the destination time"

And can you also please answer my question in my previous post "Well do you know how I can add a switch to say "Press a key to continue" in Robocopy like Xcopy does when you use the 'pause' code a the end?"

Thanks

- Collapse -
I need to ask ...
Jan 3, 2011 12:39AM PST

have YOU tried the switches Bob suggested? If not why not, and if so what were YOUR results?

As for robocopy, it will essentially do the same as XCOPY with some additional benefits such as security and attributes and a BACKUP MODE that overrides file and folder permissions. Perhaps you have missed the fact that for some of the switches to work the user MUST HAVE Backup Files and Auditing privileges.

Here is a handy link to the available switches and their functions for robocopy (HINT - look closely at the example labeled Backup a Server-
http://ss64.com/nt/robocopy.html

Now, for your last question about "...how I can add a switch to say "Press a key to continue" in Robocopy like XCOPY does when you use the 'pause' code a the end?" -- that is really easy. Run it from a batch file and use the pause command just like XCOPY.

- Collapse -
(NT) Thanks I will try that
Jan 3, 2011 6:15AM PST
- Collapse -
Have Tried them
Jan 3, 2011 11:27AM PST

Thanks for the switch sets. I like the RICHKEYS Switch. It worked well on Vista Just out of curiosity what is the difference between HICKORY and RICHKEYS?

This was my batch file

xcopy "c:\users\Aaron C\*.*" g:\backuser /r/i/c/h/k/e/y/s/d
pause

I like the /d switch because it "Copies only the files whose source time is newer than the destination time"

Is there another switch set which would do the same thing (RICHKEYS) in Robocopy and secondly is there a switch similar to /d switch in robocopy which does what I mentioned above?

Thanks to both of you so much for your help so far

- Collapse -
Sorry.
Jan 3, 2011 12:49PM PST

It's been awhile since it looked at these sets. XCOPY is documented so I would be duplicating that here if I wrote what each switch does.

Sorry about that but those two words are there so I can remember the usual sets without having to re-do the research. As to robocopy, I'm letting others write about that.
Bob

- Collapse -
Oh Yeah, Thank Bob
Jan 3, 2011 1:16PM PST

I will look up the switches for Xcopy.

In the meantime hopefully someoneelse might reply about Robocopy.