asked on
Hi,
I am trying to copy files in different subfolders with wildcards. I have tried two different ways but no luck. Any ideas? thanks
Get-ChildItem -Path "C:\database\Combine" -include "*TOTAL.*" -Recurse | Copy-Item -Destination "C:\database\Combine\TOTAL"
----------------------------------------------------------------
Copy-Item -Path "C:\database\Combine\*TOTAL.*" -Destination "C:\database\Combine\TOTAL" -recurse -Force -Verbose
Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.
TRUSTED BY
The issue is that you're copying into the directory that you're using as the source.
Use "C:\database\TOTAL" or any other folder not under "C:\database\Combine" as Destination.