Tuesday, May 31, 2016

My Powershell Code Snippets


1. Copy files from source to destination

####----Copy files from source to destination-----

$publishPathDestination      =   "Some Path"
$scriptpathSource            = Split-Path $MyInvocation.MyCommand.Path
Copy-Item  "$scriptpath"     $publishPathDestination   -Recurse -Force;

2. Duplicate and copy files

 ##---Duplicate and copy files
 
 $files="F1.pdf","F2.pdf"

 Foreach ($file in $files)
 {
       Copy-Item C:\DummyFiles\dummy.pdf -Destination C:\DummyFiles\Transfer\$file
 }


3. Sitecore Powershell extensions to create daily backup



No comments :