title: Renaming a Folder and create a new folder in PowerShell
body: <p>My folder structure: C:\example\latest.
  I want to check if the subfolder latest already exists or not. If it does, I want to rename it as latest_MMddyyyy and then create a new folder called latest.
  If it does not have latest already, then simple create the folder.</p>
  
  <p>This is what I have:</p>
  
  <pre><code>param (
      $localPath = "c:\example\latest\"                                                       #"
  )
  
          #Creating a new directory if does not exist
          $newpath = $localPath+"_"+((Get-Date).AddDays(-1).ToString('MM-dd-yyyy'))
          If (test-path $localPath){
              Rename-Item -path $localpath -newName $newpath
          }
          New-Item -ItemType -type Directory -Force -Path $localPath
  </code></pre>
  
  <p>It is doing two things:</p>
  
  <ol>
  <li>Rename my latest folder as _MM-dd-yyyy but I want it to rename as "latest_MM-dd-yyyy"</li>
  <li>Throw an error: Missing an argument for parameter 'ItemType'. Specify a parameter of type 'System.String' and try again.</li>
  </ol>
  
  <p>what am I doing wrong?</p>