• Testing Backslash removal problem

    Home » Forums » Testing Forum » Testing Backslash removal problem

    Author
    Topic
    #2472825

    Ok, Here’s some powershell code to see if the backslashes get removed when bracketed by pre tags:

    <#+---------------------------------------------------------+
      | Move files listed in a file using RoboCopy while        |
      | preserving the directory structure by appending the     |
      | source path (minus the drive spec) to the destination   |
      | path.                                                   |
      +---------------------------------------------------------+#>
    
    Clear-Host
    
    $source = Get-Content "G:\Test\111.txt" -Encoding UTF8
    
    $destination = "G:\BEKDocs\Test"
    
    
    Foreach ($SrcPath in $source) {
    
      $file     = Split-Path -Path $SrcPath -Leaf
      $path     = Split-Path -Path $SrcPath -parent
      $PLen     = $Path.Length -3
      $PAdd     = $Path.Substring(3,$PLen)
      $SavePath = Join-Path -Path $Destination -ChildPath $PAdd
    
      $robocopyOptions = @('/Move', '/copyall')
      $LogFile         = 
            @('/log+:G:\BEKDocs\Transfer\log.txt')
    
      $CmdLine = @($path, $SavePath, $file) + 
                   $robocopyOptions + $LogFile
    
      & 'robocopy.exe' $CmdLine
    
    } #End Foreach 
    

    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!
    Computer Specs

    Viewing 2 reply threads
    Author
    Replies
    • #2472826

      Seemed to work OK.

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #2472827

      Ok trying same code using the code tag button:

      
      <#+---------------------------------------------------------+
        | Move files listed in a file using RoboCopy while        |
        | preserving the directory structure by appending the     |
        | source path (minus the drive spec) to the destination   | 
        | path.                                                   |
        +---------------------------------------------------------+
      #>
      
      Clear-Host
      
      $source = Get-Content "G:\Test\111.txt" -Encoding UTF8
      
      $destination = "G:\BEKDocs\Test"
      
      Foreach ($SrcPath in $source) {
      
      $file = Split-Path -Path $SrcPath -Leaf
      $path = Split-Path -Path $SrcPath -parent
      $PLen = $Path.Length -3
      $PAdd = $Path.Substring(3,$PLen)
      $SavePath = Join-Path -Path $Destination -ChildPath $PAdd
      
      $robocopyOptions = @('/Move', '/copyall')
      $LogFile =
      @('/log+:G:\BEKDocs\Transfer\log.txt')
      
      $CmdLine = @($path, $SavePath, $file) +
      $robocopyOptions + $LogFile
      
      & 'robocopy.exe' $CmdLine
      

      } #End Foreach
      `

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #2472829

      How about a simple path entered in Visual mode.

      C:\Windows\System32\Powershell

       

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #2472830

        Well, it appears that I can’t make the error happen any more.

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

        • #2472849

          I think Susan added your IP address somewhere to make an exception for you so it wouldn’t strip the “\”. I don’t think Microfix and alejr did not have that exception for them, so they had a problem this morning. Susan may have fixed their IPs by now.

          The problem isn’t GONE, it’s just gone for those with the exception.

          1 user thanked author for this post.
    Viewing 2 reply threads
    Reply To: Testing Backslash removal problem

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: