开发者

Copy-Item cmdlet should only copy difference

Im writeing a backupscript useing powershell. I know that i could just use robocopy or rsync but i would like to do this in powershell. The problem i have has to do with the copy-item cmdlet. What my script does:

  • Read var's and fills them from a csv
  • Pings destination host
  • Checks if Outlook is open on source host and asks if it should close it
  • Then it should copy some folders onto the destination

My problem is that it always does a full copy of all files. I would like it to only copy the files that were changed or do not exist on the destination.

The second problem i have is that in Win7开发者_如何学编程 there are hidden systemfolders in "Users/Documents" that link to "My Pictures" and "My Videos". I dont need to copy these but i didnt manage to exclude them useing the exclude agrument.


Just some quick and general suggestion...

  • I would like it to only copy the files that were changed

    I would copy the files comparing the source and destination modified date

  • The second problem i have is that in Win7 there are hidden systemfolders in "Users/Documents" that link to "My Pictures" and "My Videos". I dont need to copy these but i didnt manage to exclude them useing the exclude agrument. :

    Do not use copy-item directly, but use the output of get-childitem without force parameter. This will prevent to copy hidden or system files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜