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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -