powershell - Excluding a file while using Copy-Item -
i'm having few issues while copying desktop files part of process local folder server.
my script automatically creates backup folder on server , realised when creates folder windows automatically creates desktop.ini file, , desktop.ini system file script failed write desktop.ini desktop backup folder in server.
my initial code :
copy-item ("$global:localbackuprestorelocation\desktop\$file") ("$global:remotebackuprestorepath\$nameofbackupdirectory") ($recursive="true") but use exclude in line , know exclude not work recursively , have use get-childitem.
try this
$exclude = @('desktop.ini')
copy-item -path $source -destination $dest -exclude $exclude
Comments
Post a Comment