Excluding a file while using Copy-Item

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Tim Pringle Tim Pringle 8 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33455
    Profile photo of nemo nemo
    nemo nemo
    Participant

    Hey Guys I having a bit of issues while copying desktop files as a part of the back up process from local folder to server.

    So my Script automatically creates a Backup folder and i just realise when it creates the back up folder windows automatically creates a desktop.ini file and as desktop.ini is a system file the script failed to write another desktop.ini from desktop to the backup folder in server.

    so My initial code was :

    Copy-Item ("$Global:localBackupRestoreLocation\Desktop\$file") ("$Global:remoteBackupRestorePath\$nameOfbackupDirectory") ($recursive="true")

    But I was to use the exclude in that line and i know exclude does not work recursive and i have to use get child-item.. can any one give me hand ..cheers

    #33468
    Profile photo of Tim Pringle
    Tim Pringle
    Participant

    Hey Nemo Nemo,

    Have you tried using -ErrorActionPreference 'Continue' in your Copy-Item command?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.