2

In windows batch I would do

xcopy source_spec target_spec /d/u/r/y

/d : more recent
/u : only those that exist in target
/r : ignore the read only flag
/y : don't prompt for overwrite

What's the simplest using the powershell copy-item/copy cmdlet equivalent.

And to the wags - yes I know I can do xcopy in powershell :-)

so in powershell I do:

cmd /c xcopy source_spec target_spec /d/u/r/y
Preet Sangha
  • 64,563
  • 18
  • 145
  • 216

1 Answers1

5

No there is no straightforward equivalent without writing few lines of script. Use xcopy or robocopy.

manojlds
  • 290,304
  • 63
  • 469
  • 417
  • Thank you. Good to know I'm not going mad! Actually - can you give me some powershell code for future reference please? I'm only a dabbler in it and would welcome a look at some experts code. – Preet Sangha Sep 11 '11 at 22:07
  • 1
    [PowerShel Code Repository](http://poshcode.org/) is a place here you can found PowerShell good samples. As welle as [Technet Script Center Repository](http://gallery.technet.microsoft.com/scriptcenter/site/search/?f%5B0%5D.Type=ScriptLanguage&f%5B0%5D.Value=PowerShell&f%5B0%5D.Text=PowerShell) – JPBlanc Sep 12 '11 at 03:47