# PowerShell Newbie Question

**URL:** <https://forums.powershell.org/t/powershell-newbie-question/13840>\
**Category:** PowerShell Help\
**Created:** [February 20, 2020, 3:31am UTC](https://forums.powershell.org/t/powershell-newbie-question/13840 "2020-02-20T03:31:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mido\_9393](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mido\_9393](https://forums.powershell.org/u/mido_9393)\
**Post date:** [February 20, 2020, 3:31am UTC](https://forums.powershell.org/t/powershell-newbie-question/13840/1 "2020-02-20T03:31:02Z")

</div>

Dear All,

Excuse my lack of experience. I am trying to generate a text file that includes all files that end with ‘\*.txt’ from the whole HARD-DRIVE, using Mac

my command looks like the following:

| Get-ChildItem -Path "./" -Recurse -Name -Include '\*.txt' | Out-File "./Desktop/JUNK/HD-Files.txt" |

It works very well and very fast but my problem is the '-recurse' commant which doesn't stop on my terminal I always end up stopping the command myself.

Anybody knows how I can solve that on the command-line itself?

&nbsp;

I would appreciate the help!

&nbsp;

Regards,

Mido

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [February 20, 2020, 8:07am UTC](https://forums.powershell.org/t/powershell-newbie-question/13840/2 "2020-02-20T08:07:09Z")

</div>

Recursion is going to look for files in every directory at every depth, so when you say it doesn’t stop, what exactly does that mean? 10 minutes, 2 hours? Are you seeing a file created with the file information?

The only thing that I would recommend is that you create a csv rather than a text file. Powershell will return an object, which is more of a table.

```
Get-ChildItem -Path “./” -Recurse -Name -Include ‘*.txt’ | Export-CSV “./Desktop/JUNK/HD-Files.csv” -NoTypeInformation
```

---

<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:** [February 20, 2020, 8:09am UTC](https://forums.powershell.org/t/powershell-newbie-question/13840/3 "2020-02-20T08:09:25Z")

</div>

Hmmm … I do not have a Mac so I’m not able to reproduce but you might elaborate a little more what’s your problem.

If you start _Get-ChildItem_ in the root and tell it to _-Recurse_ it will only stop if it has searched each and evetry single folder on the drive. It might just take a little longer … did you try to wait a little longer?

---

<div class="post-metadata">

**Author:** ![mido\_9393](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@mido\_9393](https://forums.powershell.org/u/mido_9393)\
**Post date:** [February 20, 2020, 10:51am UTC](https://forums.powershell.org/t/powershell-newbie-question/13840/4 "2020-02-20T10:51:38Z")

</div>

[quote quote=204876]Hmmm … I do not have a Mac so I’m not able to reproduce but you might elaborate a little more what’s your problem.

If you start _Get-ChildItem_ in the root and tell it to _-Recurse_ it will only stop if it has searched each and evetry single folder on the drive. It might just take a little longer … did you try to wait a little longer?

[/quote]

[quote quote=204873]Recursion is going to look for files in every directory at every depth, so when you say it doesn’t stop, what exactly does that mean? 10 minutes, 2 hours? Are you seeing a file created with the file information?

The only thing that I would recommend is that you create a csv rather than a text file. Powershell will return an object, which is more of a table.

\<textarea class="ace\_text-input" style="opacity: 0; height: 18px; width: 7.2246875px; left: 45px; top: 0px;" spellcheck="false" wrap="off"\>\</textarea\>

1

2

Get-ChildItem -Path “./” -Recurse -Name -Include ‘\*.txt’ | Export-CSV “./Desktop/JUNK/HD-Files.csv” -NoTypeInformation

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[/quote]

I appreciate your reply! Indeed I got used to PS being fast even with large data, which is why I haven’t given it enough time apparently. But now after you suggested to do that, it actually worked and it stopped by itself.

&nbsp;

Thank you very much!

Regards,

Mohamed.

---

<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:30pm UTC](https://forums.powershell.org/t/powershell-newbie-question/13840/5 "2024-05-16T20:30:28Z")

</div>

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


