Copy all files with a certain name using Powershell



The ability to quickly and easily copy files with a certain name can be a lifesaver when an IT admin is working with large numbers of files and folders. Fortunately, PowerShell provides a simple way to copy all files with a certain name.

The first step is to create a variable to store the path to the source folder. To do this, the following command can be used:

$sourcePath = “C:\\myFolder\\sourceFolder”

Once the variable is set, use the Get-ChildItem cmdlet to list all files in the folder that match the given name. This can be done using the following command:

Get-ChildItem $sourcePath -Filter “*.FileName”

This will return a list of all files with the .FileName extension in the source folder.

The next step is to use the Copy-Item cmdlet to copy the files to the destination folder. To do this, use the following command:

Copy-Item $sourcePath -Destination “C:\\myFolder\\destinationFolder”

This will copy all files with the .FileName extension from the source folder to the destination folder.

That’s all there is to it! With just a few lines of code, an IT admin can easily copy all files with a certain name using PowerShell. This can save a great deal of time and effort when dealing with large numbers of files and folders.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo