Powershell Scripting - Zipping, Moving BAK files to a new folder named for the date of BAK file creation
<p>Firstly, Hello and apologies for the stupidly long title...</p>

<p>Secondly, I hope someone out there can help with what should be a simple task that has annoyed me for the past 4days, I will elaborate;</p>

<ol>
<li>I have 4 x BAK file that are created between 22:30 and 23:00hrs each night.</li>
<li>Each BAK file is named differently and we append the date in format "yyyy_MM_dd".</li>
<li>I need to 7z each BAK file into separate archives and move them to a new directory either named for the date they where created or the appended date of the file but keep the format "yyyy_MM_dd". (Both will be the same obviously but the code will be different, so whichever is easiest)</li>
</ol>

<p>I believe I have the separate lines for some of the script I need...</p>

<ul>
<li>For Creating the 7z</li>
</ul>

<blockquote>
  <p>dir *.bak | ForEach-Object { &amp; "C:\Program Files\7-Zip\7z.exe"
  a -t7z -mx3 ($<em>.Name+".7z") $</em>.Name }</p>
</blockquote>

<ul>
<li>For Creating the folder</li>
</ul>

<blockquote>
  <p>$Folder = New-Item -ItemType Directory -Path
  "DRIVE2:\Folder1\Folder2\$((Get-Date).ToString('yyyy-MM-dd'))"</p>
</blockquote>

<ul>
<li>For Moving the files</li>
</ul>

<blockquote>
  <p>Get-ChildItem 'DRIVE1:\Folder1\Folder2\*.7z' | Copy-Item
  -Destination $Folder</p>
</blockquote>

<p>Can someone point out where I am being a complete nugget with this?</p>

<p>Thanks in advance</p>

<p>RobD</p>