0

I'm trying to copy some files from one diretory to another, check if exists and replace name if yes. And copy all files.

But it gives me the above message:

    cmdlet Copy-Item at command pipeline position 1
    Supply values for the following parameters:
    Path[0]: 
    PS C:\Scripts\MetadataExport> 

What i'm doing wrong?

My code:

  Get-ChildItem -Path "C:\Scripts\MetadataExport\*\*" -Directory | ForEach-Object {  
  $_.FullName | ForEach-Object {Get-ChildItem $_ *.opex | ForEach-Object{If([System.IO.File]::Exists("C:\Scripts\MetadataExport\$Bundles")){While($true){$i=0
  $i++
  $_.Name= $_+$i}
  }Else{Copy-Item -Destination "C:\Scripts\MetadataExport\$Bundles" }}

  Get-ChildItem $_ -Recurse -Include *.xip | ForEach-Object{If([System.IO.File]::Exists("C:\Scripts\MetadataExport\$Bundles")){While($true){$i=0
  $i++
  $_.Name= $_+$i}
  }Else{Copy-Item -Destination "C:\Scripts\MetadataExport\$Resources"}}
  }
  } 

Thanks for any help on this

1
  • 3
    you have not told Copy-Item what to copy ... [grin] Commented Nov 2, 2020 at 19:07

1 Answer 1

1

The syntax is Copy-Item -Path "yourpathhere" -Destination "yourdestinationhere"

You've not specified path.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.