title: How to set LastWriteTime property of a file?
body: <p>I would like to change the creation date of the files that I generate with this script : </p>
  
  <pre><code>$clientname = Read-Host "Enter the client name"
  $path = Read-Host "Enter the complete path of .bak files"
  
  $time = "01-00-00"
  $space = " "
  
  
  for ($i = 0; $i -lt 7;$i++)
  {
  
  $date = (Get-Date).AddDays(-1-$i).ToString('yyyy-MM-dd') 
  
  New-Item -ItemType file $path$clientname$space$date$space$time.bak
  
  }
  </code></pre>
  
  <p>So it gives me theses files :  </p>
  
  <pre><code>Mode                LastWriteTime     Length Name                                                          
  ----                -------------     ------ ----                                                          
  -a---        16/08/2013     16:55          0 client 2013-08-15 01-00-00.bak                                  
  -a---        16/08/2013     16:55          0 client 2013-08-14 01-00-00.bak                                  
  -a---        16/08/2013     16:55          0 client 2013-08-13 01-00-00.bak                                  
  -a---        16/08/2013     16:55          0 client 2013-08-12 01-00-00.bak                                  
  -a---        16/08/2013     16:55          0 client 2013-08-11 01-00-00.bak                                  
  -a---        16/08/2013     16:55          0 client 2013-08-10 01-00-00.bak                                  
  -a---        16/08/2013     16:55          0 client 2013-08-09 01-00-00.bak  
  </code></pre>
  
  <p>I want to modify the LastWriteTime property of each files, I want it to be the same as the date in the file name.</p>
  
  <p>Example for this file <code>"client 2013-08-15 01-00-00.bak"</code> the LastWriteTime will be <code>"15/08/2013 01:00"</code></p>
  
  <p>I'm stuck and I do not how can we do that</p>
  
  <p>Thank you </p>