Function not recognized..HELP

Welcome Forums General PowerShell Q&A Function not recognized..HELP

Viewing 2 reply threads
  • Author
    Posts
    • #223257
      Inactive
      Topics: 1
      Replies: 1
      Points: 0
      Rank: Member
      function movedata {
      
          param ($sourcePath, $targetPath, $files, $newPath)
      
          $sourcePath = \\host-name\share-name\file_path
      
          Write-Output "$sourcePath"
      
      
      
      
          $targetPath = \\host-name\share-name\file_path
      
          Write-Output "$targetPath"
      
      
      
      
          $files = Get-ChildItem $sourcePath -Recurse | Where-Object { $_.LastWriteTime -gt (get-date).date }
      
      
      
      
          $newPath = Join-Path -Path $targetPath -ChildPath ($_.LastWriteTime)
      
          if (!(Test-Path -Path $newPath)) {
      
              Write-Output "Creating directory $newPath"
      
              New-Item -Path $newPath -ItemType Directory
      
          }
      
          Compress-Archive -DestinationPath $targetPath.zip
      
          Write-Output "$files"
      
          Write-Output "Starting copy"
      
          ForEach-Object {Move-Item -path $sourcePath -destination $targetPath}
      
          Write-Output  "$files copied to $targetPath"
      
      }
    • #223260
      Inactive
      Topics: 1
      Replies: 1
      Points: 0
      Rank: Member

      This scripts purpose is to move data (recursively) by date modified across environments.

    • #223398
      Participant
      Topics: 3
      Replies: 340
      Points: 1,120
      Helping Hand
      Rank: Community Hero

      I recognize that function. Not sure if this resolves your issue or not. Could you elaborate?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.