title: I have a file organiser powershell script which runs without any error but it doesnt perform the moving operation
body: <p>It is a file organiser script I wrote for myself. For a specific purpose of mine. Whenever I try to run it It runs and closes off. But the move operation is not happening. The below comments may help you understand what the code is doing.Please help me on what am i doing wrong here. I am extremely new to Powershell Scripting.</p>
  <pre><code>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  
  # Global variable declarations
  $global:pathsFromConfig = Get-Content -Path $PSScriptRoot&quot;\MoverPaths.txt&quot;
  $global:categoriesFromConfig = Get-Content -Path $PSScriptRoot&quot;\MoverCategories.txt&quot;
  $global:categryHash = @{}
  
  # Method call to read configs, create dirs, &amp; move files
  readCreateAndMoveFiles
  
  # Method definition
  function readCreateAndMoveFiles{
      # Reads categories config.txt and splits them line by line
      # Adds each line as a key value pair to a hashtable
      foreach($category in $categoriesFromConfig)
      {
          $temp = $category -split &quot;:&quot;  
          $categryHash.add($temp[0].trim().toString(),($temp[1]).trim().toString())
      }
  
      # For each category in the hash table, calls create directory method, and then moves the files based on current category
  
      foreach($hashItem in $categryHash.GetEnumerator()){
          # Creates a directory with the Hash Key
          Foreach($pathToMonitor in $pathsFromConfig){
              $categoryFullPath = $pathToMonitor+$hashItem.Name
              createDirectory($categoryFullPath)
  
              # Moves files into that directory 
              Set-Location -Path $pathToMonitor
              $extentions = $hashItem.Value
              Get-Item $extentions | Move-Item -Destination $categoryFullPath
              $categoryFullPath = &quot;&quot;
          }
      }
  }
          
  # Method Definition
  function createDirectory ($categoryName)
  {
      if(Test-Path -Path $categoryName)
      {
          # Directory already Exists!
      }
      else
      {
          # Creates Directory
          md $categoryName
      }
  }
  </code></pre>
  <p>The config files are hereby:</p>
  <p><strong>MoverCategories.txt</strong>
  <code>Images:*.jpg,*.jpeg,*.png,*.tiff,*.raw,*.heic,*.gif,*.svg,*.eps,*.ico</code>
  <code>Documents:*.txt,*.pdf,*.doc,*.docx,*.xls,*.xlsx,*.ppt,*.pptx,*.html,*.xls,*.csv,*.rtx</code></p>
  <p><strong>MoverPaths.txt</strong></p>
  <pre><code>D:\Downloads\
  </code></pre>