title: How do I remove Blank Space from File Names
body: <p>I am trying to remove blank spaces from many file names using PowerShell 3.0. Here is the code that I am working with: </p>
  
  <pre><code>$Files = Get-ChildItem -Path "C:\PowershellTests\With_Space"
  Copy-Item $Files.FullName -Destination C:\PowershellTests\Without_Space
  Set-Location -Path C:\PowershellTests\Without_Space
  Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace ' ','' }
  </code></pre>
  
  <p>For example: the With_Space directory has these files: </p>
  
  <pre>Cable Report 3413109.pdf
  Control List 3.txt
  Test Result Phase 2.doc</pre>
  
  <p>The Without_Space directory will need the above file name to be: </p>
  
  <pre>CableReport3413109.pdf
  ControlList3.txt
  TestResultPhase 2.doc</pre>
  
  <p>Currently, the script shows no error but it only copies the source files to the destination folder, but doesn't remove the spaces in file names. </p>