Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

PowerShell Copy-Item: Duplicate Files Fast and Safely

How to use PowerShell's Copy-Item without flattening folders, matching extra files, or overwriting existing ones.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Copy-Item duplicates a file or folder and leaves the original where it is. Most mistakes come from four things: copying a folder without -Recurse, mixing up a folder with its contents, letting a wildcard match more than intended, and overwriting same-name files in the destination. The patterns below cover each one. They are illustrative commands built from Microsoft Learn’s documentation, not results from a test run, and they focus on the FileSystem provider.

Copy a single file

Name the source with -Path and a destination folder with -Destination:

Copy-Item -Path 'C:WabashLogfilesmar1604.log.txt' -Destination 'C:Presentation'

By default the cmdlet prints nothing, so silence is normal. Add -PassThru if you want the resulting item object returned. That object is not an integrity check; it just shows what was created. Quote any path containing spaces, using ordinary PowerShell quoting rules.

Copying is not moving. The source stays in place. What Copy-Item can copy also depends on the PowerShell provider, and this guide assumes the file system.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Copy a folder and its subfolders

A directory needs -Recurse if you want its descendants copied. The shape of the result then depends on how you write the source.

Copy the folder itself under a new name

Copy-Item -Path 'C:Logfiles' -Destination 'C:DrawingsLogs' -Recurse

Here the source names the directory, and the destination gives the copy its name.

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Copy only the folder’s contents

Copy-Item -Path 'C:Logfiles*' -Destination 'C:Drawings' -Recurse

The trailing * selects what is inside C:Logfiles, not the folder. The two forms are not interchangeable. Microsoft’s example warns that if the destination in the contents form does not exist, the contents are copied into a single folder named for the destination, and same-name files can be overwritten. That is how a tree gets flattened by accident. Create the destination first or inspect the result of a small run before doing a bulk copy.

Goal Source form Destination
Duplicate the folder under a chosen name 'C:Logfiles' The new folder path, e.g. 'C:DrawingsLogs'
Copy what is inside the folder 'C:Logfiles*' An existing folder, e.g. 'C:Drawings'

Avoid overwriting files you care about

Microsoft’s about_FileSystem_Provider documentation states: “Copy-Item overwrites files in the destination directory without prompting for confirmation.” Plan on that behavior. The documentation examples cover distinct file and directory situations, so do not assume one overwrite rule holds for every provider or scenario.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

-Force is not a safety prompt. Per the reference, it lets the cmdlet copy items that otherwise cannot be changed, such as a read-only file or an alias. Microsoft’s file-and-folder sample uses it to overwrite a pre-existing destination file, so adding it can make an overwrite succeed where it would otherwise fail.

Practical habits:

  • Check what already exists in the destination before a bulk copy.
  • Preview with -WhatIf (below).
  • Keep a separate backup of anything important.

Preview with -WhatIf

Copy-Item -Path 'C:data*' -Destination 'C:backup' -Recurse -WhatIf

-WhatIf reports what would happen without performing the copy. Read the output for the destination paths, since that is where flattening and collisions show up. It previews the operation; it is not a verification that a later real copy is intact.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Copy only matching files from a whole tree

It is tempting to use -Include or -Exclude with -Recurse. The Copy-Item reference says -Include filters the wildcard-matching result of -Path and is only effective when the path contains a wildcard. It does not filter items discovered during recursion. A wildcard-selected top-level folder can therefore be copied with contents that do not match your pattern.

For matching files at every level, Microsoft’s documented pattern finds them first and pipes them in:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0
  • [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
Get-ChildItem -Path 'C:data' -Recurse -Filter '*.txt' | Copy-Item -Destination 'C:temptext'

Check the layout you expect. Piping files to a single destination folder places them side by side, so same-name files from different subfolders can overwrite one another. Test with -WhatIf first.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

-Path versus -LiteralPath

-Path interprets wildcard characters. -LiteralPath treats the string exactly as written. If a real filename contains characters such as [ or *, use -LiteralPath so you copy that file and nothing else:

Copy-Item -LiteralPath 'C:datareport[final].txt' -Destination 'C:backup'

Use -Path when you want pattern matching, as in C:Logfiles*.

Quick pre-flight checklist

  1. Is the source a file, a folder, or a folder’s contents? Choose the path form accordingly.
  2. Does the destination exist? If not, decide whether you want it created as the copy’s name or as a container.
  3. Do filenames contain wildcard characters? Use -LiteralPath.
  4. Need pattern matching across subfolders? Use Get-ChildItem -Recurse -Filter.
  5. Run with -WhatIf, then without.

Other tools

Microsoft notes that native xcopy.exe and robocopy.exe remain available from PowerShell. The documentation consulted here does not support a speed or feature ranking, and no performance figures are claimed. “Fast” here means fewer mistakes and less rework, not a measured benchmark.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Further learning

If you want to move from one-off commands to automation, Learn PowerShell Scripting in a Month of Lunches, Second Edition by James Petty, Don Jones, and Jeffery Hicks (Manning) is a PowerShell scripting book that its publisher describes as teaching how to create, organize, test, and share scripts and tools. You do not need it to use Copy-Item.

Quick Recap

SaleBestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$229.99
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$208.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.