# Move files from various folders to one

**URL:** <https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804>\
**Category:** PowerShell Help\
**Created:** [August 23, 2023, 12:41pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804 "2023-08-23T12:41:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kforan](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kforan](https://forums.powershell.org/u/kforan)\
**Post date:** [August 23, 2023, 12:41pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/1 "2023-08-23T12:41:11Z")

</div>

Hi. I’m new to this. I have a list of file names in an Excel spreadsheet. They are in various folders in a drive. I’m looking to go through the list, find the files and move them to a single folder. In other words, go one by one through the Excel file, search for the file and then move it. They all will be moved to the same folder. I appreciate any help you can provide. Thank you.

---

<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:** [August 23, 2023, 3:23pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/2 "2023-08-23T15:23:34Z")

</div>

Ken,  
Welcome to the forum. 👋🏼

> [@kforan](#):
>
> I have a list of file names …

That’s a nice task for practicing I think. Do you have any question?

> [@kforan](#):
>
> I appreciate any help you can provide.

What help do you expect?

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

---

<div class="post-metadata">

**Author:** ![kforan](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kforan](https://forums.powershell.org/u/kforan)\
**Post date:** [August 23, 2023, 3:38pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/3 "2023-08-23T15:38:25Z")

</div>

Thanks for your help. Do you have any suggestions on where I can go with help to learn and get started? Thanks.

---

<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:** [August 23, 2023, 4:49pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/4 "2023-08-23T16:49:42Z")

</div>

> [@kforan](#):
>
> Do you have any suggestions on where I can go with help to learn and get started?

It depends pretty much on how new you are to this …

This video series is somewhat old but I think it’s still worth to watch for beginners

> **[Getting Started with PowerShell 3.0](https://learn.microsoft.com/en-us/shows/getstartedpowershell3/)**
>
> This Jump Start is designed to teach the busy IT Professionals about this powerful management tool. Learn how PowerShell works and how to make PowerShell work for you from the experts Jeffrey Snover, the inventor of PowerShell, together with Jason...

Don’t worry that it is about PowerShell version 3. The basics are still the same.

---

<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:** [August 24, 2023, 8:52pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/5 "2023-08-24T20:52:21Z")

</div>

Definitely follow Olaf’s recommendation and take a look at some videos. I’ll add a bit more advice here as well.

It might be easier to start off with the list of file names in a text file or a CSV (assuming the excel doc you are referring to is a XLSX format). It’ll be easier to learn. However, if it has to be an excel document I highly recommend looking into the ‘ImportExcel’ module by Doug Finke: [dfinke/ImportExcel: PowerShell module to import/export Excel spreadsheets, without Excel (github.com)](https://github.com/dfinke/ImportExcel). It will allow you to import the data really easily from an excel file and use it in Powershell using `Import-Excel` command. if it’s a text or csv file, Powershell has built in commands to handle those (`Get-Content` and `Import-CSV` are two I use pretty often).

The tasks end up being:

1. Get the data into Powershell from the file.
2. Iterate through each of the lines or objects to get your file name.
3. take action (move) the file to the folder of choice). Perhaps confirm the file exists prior to moving.

So additional commands you may find helpful on your journey might be:

ForEach-Object  
Move-Item  
Test-Path  
Get-Item

You can run `Get-Help -Name Move-Item` in a PowerShell window to learn more about that command. I also have teh tendency to just run `Get-Help -Name Move-Item -Online` or search for the command in Google to get to the online help page.

Hopefully this gets you started on your journey!

---

<div class="post-metadata">

**Author:** ![kforan](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kforan](https://forums.powershell.org/u/kforan)\
**Post date:** [August 25, 2023, 2:57pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/6 "2023-08-25T14:57:35Z")

</div>

Thank you for the suggestions!

---

<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:14pm UTC](https://forums.powershell.org/t/move-files-from-various-folders-to-one/22804/7 "2024-05-16T20:14:43Z")

</div>

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


