the Copy commond with "-include"

while my command like this:

Copy-Item ‘C:\trans*’-Include ‘*.flv’ -Destination ‘C:\test’ -Recurse -Force

but it does not work

while i change the “-include” into “-exclude” it really work ;

I don’t know why

Inaho, welcome to Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

When you post code or error messages or sample data or console output format it as code using the code tags “PRE”, please. Thanks in advance.

What exactly do you mean with:

What is in your source directory and what would you expect to happen? You could try the parameter -Filter instead.

Copy-Item ‘C:\trans*’ -Filter ‘*.flv’ -Destination ‘C:\test’ -Recurse -Force

What’s the error message? It works for me, as long as the source path has a wildcard. Only .flv files are copied.

I did this ,but nothing has be copied still.

What happens when you use Get-ChildItem with the parameter you use for Copy-Item?

Get-ChildItem -Path 'C:\trans\*' -Include '*.flv' -Recurse

You might try it with the parameter -Filter as well …

Get-ChildItem -Path 'C:\trans\*' -Filter '*.flv' -Recurse