title: copy files from folder and then delete some files with an exception
body: <p>I have folder called <code>Logfolder</code> in C.</p>
  <pre><code>C:\LogFolder
  </code></pre>
  <p>it has multiple logs with name as follows</p>
  <pre><code>errorLogs.log
  errorLogs.log.1
  errorLogs.log.2
  errorLogs.log.3
  
  Transmitlogs.log
  Transmitlogs.log.1
  Transmitlogs.log.2
  Transmitlogs.log.3
  Transmitlogs.log.4
  Transmitlogs.log.5
  
  Receivelogs.log
  Receivelogs.log.1
  Receivelogs.log.2
  Receivelogs.log.3
  Receivelogs.log.4
  
  Dataexchange.log
  Dataexchange.log.1
  </code></pre>
  <p>and many other with the different name but with same extension like .log, .log.1 and so on.</p>
  <p>I am interested in only above mention logs.</p>
  <p>my goal is to copy this logs starting from <code>log.1</code> upto <code>log.10 or 20</code> all which exist and than
  delete the original file with an exception <code>.log and .log.1</code>.</p>
  <p>I have achieved following until now.</p>
  <pre><code>$logLocation = &quot;C:LogFolder&quot;
  $tempLocation = &quot;C:\Temp\Logs\&quot;
  
  $LogfileName = &quot;errorLogs.log.&quot;, &quot;Transmitlogs.log.&quot;,&quot;Receivelogs.log.&quot;,&quot;Dataexchange.log.&quot;
  foreach ($element in $LogfileName) 
  {
  $NewLogFileName = -join($element,&quot;*&quot;)
  Copy-Item -Path &quot;$logLocation\$NewLogFileName&quot; -Destination $tempLocation
  }
  </code></pre>
  <p>I am able to copy all logs starting from .log.1 and all other which exist.</p>
  <p>my problem is how can i delete those logs from original folder without deleting .log and .log.1</p>
  <p>I have tried the following but not working.</p>
  <pre><code>foreach ($element in $LogfileName) 
  {
  $deleteLogFileName = -join($element,&quot;*&quot;)
  Remove-Item –path &quot;$logLocation\$deleteLogFileName&quot; -exclude *.log, *.log.1
  }
  </code></pre>