Powershell Command to Copy Files by Date Modified to a new location and maintain folder structure from old location -
im trying copy files network drive modify date , maintain folder structure in new location. can guys help?
thanks
i'm feeling generous, can feed script despite lack of "i've tried <some code>
it's giving me these errors" in question. future may want read jon skeet's 'writing perfect question' , remember site here people through problems, not work you.
ok, getting off soap box, search share, compare lastmodified date against date provide, , copy destination, creating folders needed
$source = "\\server01\share`$\target\folder" $dest = "d:\network backup" $trgtdate = "06/04/2014" gci $source -file -recurse|%{ $target=$_.fullname -replace "($([regex]::escape($source)))(.*?)($([regex]::escape($_.name)))","$dest`$2" if(!(test-path $target)){new-item -path $target -itemtype directory|out-null} copy-item $_ -destination $target }
Comments
Post a Comment