# Copy-item = no output

**URL:** <https://forums.powershell.org/t/copy-item-no-output/14204>\
**Category:** PowerShell Help\
**Created:** [April 20, 2020, 10:01am UTC](https://forums.powershell.org/t/copy-item-no-output/14204 "2020-04-20T10:01:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [April 20, 2020, 10:01am UTC](https://forums.powershell.org/t/copy-item-no-output/14204/1 "2020-04-20T10:01:48Z")

</div>

Hello Fellow Powershellers

I’ve been tasked with decommissioning a server. This server has text files, CSV, XLS all over the C:\ drive. I need to copy all of those files to a USB attached disk. This is what I’ve come up with:

[pre]

$Source = "C:"

$Target = “F:\Import”

$Include = ‘_.txt’,'_.csv’,‘_.xls’,'_.xlsx’

Copy-Item -Path $Source -Destination $target -Force -Include $Include -Recurse

[/pre]

The folder F:\Import does exist. Hopefully it’s something obvious I’m missing.

Please help.

Kind regards, Darren

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 20, 2020, 10:16am UTC](https://forums.powershell.org/t/copy-item-no-output/14204/2 "2020-04-20T10:16:52Z")

</div>

Why not using robocopy? It’ll be way faster anyway. 😉

```
robocopy C:\ F:\import *.txt *.csv *.xls *.xlsx /S
```

… should do it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [April 20, 2020, 10:29am UTC](https://forums.powershell.org/t/copy-item-no-output/14204/3 "2020-04-20T10:29:14Z")

</div>

Thank you Olaf,

and there was me trying to learn some PowerShell 😉 what was I thinking?

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [April 20, 2020, 11:10am UTC](https://forums.powershell.org/t/copy-item-no-output/14204/4 "2020-04-20T11:10:47Z")

</div>

> [@](#):
>
> I’ve been tasked with decommissioning a server.

Sorry. This didn’t sound like you just wanted to practice. 😉 … there are still situations where Powershell is not the number one option to choose.

So - here the part for your education: 😉  
If you want to copy files you have to add an asterisk (_) at the end of your source directory_

```
_$Source = ‘C:\*’  
$Target = ‘F:\Import’  
$Include = '_.txt’, ‘_.csv’, '_.xls’, ‘*.xlsx’

Copy-Item -Path $Source -Destination $target -Force -Include $Include
```
  
But that wouldn’t copy files from subdirectories.  
If you want to include subdirectories you have to use a Get-ChildItem before … like this:
```
Get-ChildItem -Path $Source -Include $Include -Recurse -Force | Copy-Item -Destination $Target -Recurse -Force
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [April 21, 2020, 2:23am UTC](https://forums.powershell.org/t/copy-item-no-output/14204/5 "2020-04-21T02:23:11Z")

</div>

Hi Olaf,

everyday is a school day in IT. I try to use most situations to learn something. It all adds to the spice of life.

Thank you for coming back with further explanation. It always seems so obvious when someone else demonstrates it.

Kind regards, Darren

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/copy-item-no-output/14204/6 "2024-05-16T20:29:49Z")

</div>

Closed on May 16, 2024, 8:29pm UTC


