Here's a sample Powershell script
$source="C:\Backup"
$destination="D:\temp\backup"
get-childitem -path $source -recurse | where {!$_.PSIsContainer}
foreach {
$path=$destination+$_.fullname.remove(0,$source.le ngth)
# test if the file already exist on destination direcotry
if(test-path $path -pathtype leaf){
# if the file sizes are not equal copy the file again - overwrite
if($_.length -ne (get-childitem $path).length){
write-host "files $($_.name) length dont match"
copy-item $_.fullname -destination $path
}
} else {
write-host "the file $($_.name) doesn't exist, copy to destination"
copy-item $_.fullname -destination $path -force
}
--
Shay Lev
-----------------------------------------------------------------------
Shay Levi's Profile:
http://forums.techarena.in/member.php?userid=3587
View this thread:
http://forums.techarena.in/showthread.php?t=85903
http://forums.techarena.i