title: Copy file with square brackets [ ] in the filename and use * wildcard
body: <p>I'm using PowerShell on Windows 7, and writing a script to copy a bunch of files from one folder structure to another.  Kind of like compiling.  The PowerShell <code>Copy-Item</code> cmdlet thinks that square brackets, [ ], are wildcards of some kind, and I am not able to escape them for some reason.</p>
  
  <p>I can't use <code>-LiteralPath</code>, because I want to use an asterisk * wildcard since the filename has a date as part of the filename, and the date changes.  The date is used as a version number.</p>
  
  <p><a href="https://superuser.com/q/212808">This post</a> was helpful, but no amount of ticks (2x or 4x per bracket) escapes the square brackets.</p>
  
  <p>I am not receiving an error; PowerShell behaves the same as if I entered in the wrong filename.</p>
  
  <p>This is the specific line I'm working on:</p>
  
  <pre><code>#to Fusion Server
  Copy-item -Path $FSG\$SW\0.RoomView.Notes\starter\"[RoomView] Versions explained*.pdf" -Destination $FSG\$containerFolder\$rootFolder\"Fusion Server"\
  </code></pre>
  
  <p>And this is the whole thing:</p>
  
  <pre><code># Compiles the Fusion packet for distribution
  
  ###############################
  ###########Variables###########
  ###############################
  
  #folder structure
  $FSG = "F:\FSG"
  $containerFolder = "Packet.Fusion for IT and AV Professionals"
  $rootFolder      = "Fusion for IT and AV pros $(Get-Date -format “MM-dd-yyyy”)"
  $subRoot1        = "Fusion Server"
  $subRoot2        = "Scheduling Enhancement and Panels"
  $subRoot2sub1    = "Scheduling Panels"
  $subRoot3        = "SQL Server"
  
  #source folders
  $HW      = "0.Hardware"
  $3SMDoc  = "0.Hardware\TPMC-3SM.Documentation"
  $4SMDoc  = "0.Hardware\TPMC-4SM.Documentation"
  $4SMDDoc = "0.Hardware\TPMC-4SM-FD.Documentation"
  $730Doc  = "0.Hardware\TSW-730.Documentation"
  $730OLH  = "0.Hardware\TSW-730.OLH"
  $CENRVS  = "0.Hardware\CEN-RVS.Notes"
  
  $ProjMgmt = "0.Project Management"
  
  $SW            = "0.Software"
  $RVLicensing   = "0.Software\0.RoomView.License"
  $RVNotes       = "0.Software\0.RoomView.Notes"
  $SQLLicensing  = "0.Software\database.SQL.Licensing"
  $SQLNotes      = "0.Software\database.SQL.Notes"
  $FRVMarketing  = "0.Software\Fusion RV.Marketing"
  $FRVNetworking = "0.Software\Fusion RV.Networking"
  $FRVNotes      = "0.Software\Fusion RV.Notes"
  
  
  ###############################
  #create the directory structure
  ###############################
  
  md -Path $FSG\$containerFolder -Name $rootFolder
  
  cd $FSG\$containerFolder\$rootFolder
  md "eControl and xPanels"
  md "Fusion Server" #$subRoot1
  md "Getting Started as a User"
  md "Project Management"
  md "RoomView Connected Displays"
  md "Scheduling Enhancement and Panels" #$subRoot2
  md "SQL Server" #$subRoot3
  
  cd $FSG\$containerFolder\$rootFolder\$subRoot1
  md "CEN-RVS"
  md "Licenseing Information"
  md "Networking"
  md "Official Documentation"
  md "Prerequisites, including powerShell script"
  md "Product Info"
  md "Requirements"
  md "Tech Info"
  md "Windows Authentication to Fusion RV"
  
  cd $FSG\$containerFolder\$rootFolder\$subRoot2
  md "Outlook Add-in"
  md "Scheduling Panels" #$subRoot2sub1
  
  cd $FSG\$containerFolder\$rootFolder\$subRoot2\$subRoot2sub1
  md "TPMC-3SM"
  md "TPMC-4SM"
  md "TPMC-4SM-FD"
  md "TSW-730"
  
  cd $FSG\$containerFolder\$rootFolder\$subRoot3
  md "Multi-database model only"
  md "SQL Licensing"
  
  cd $FSG\$containerFolder
  #reset current folder
  
  
  ###############################
  #copy the files
  ###############################
  
  #Copy-Item -Path C:\fso\20110314.log -Destination c:\fsox\mylog.log
  
  #To the root
  Copy-item -Path $FSG\$ProjMgmt\starter\"Fusion Support Group Contact info*.pdf" -Destination $FSG\$containerFolder\$rootFolder\
  Copy-item -Path $FSG\$containerFolder\"Fusion for IT and AV professionals release notes.txt" -Destination $FSG\$containerFolder\$rootFolder\
  
  #to eControl and xPanels
  Copy-item -Path $FSG\$SW\xpanel.Notes\starter\*.* -Destination $FSG\$containerFolder\$rootFolder\"eControl and xPanels"\
  
  #to Fusion Server
  Copy-item -Path $FSG\$SW\0.RoomView.Notes\starter\"[RoomView] Versions explained*.pdf" -Destination $FSG\$containerFolder\$rootFolder\"Fusion Server"\
  </code></pre>
  
  <p>What can I do to escape the square brackets and still use a wildcard filename part of the <code>Copy-Item</code> cmdlet?</p>