I have a network drive contains couple millions of files from multiple folders. I was provided with a list filepaths in delimited format. How to copy all the files into one single folder using PowerShell?
Asked
Active
Viewed 183 times
0
-
1Having a few million files in one NTFS directory is a [bad idea](https://stackoverflow.com/q/197162/503046). Nevertheless, try `import-csv` to import the file and the a `foreach` loop with `copy-item`. – vonPryz Jun 11 '21 at 15:43
-
Gotta agree with Von with the exception of piping it to `Copy-item` which should accept all those names. – Abraham Zinala Jun 11 '21 at 16:33
1 Answers
0
You could try by looping each filepath, and copy using current filepath as first parameter and some common path variable for destination
- Loop file content (Read file line by line in PowerShell)
- Copy item to wanted folder: [Example]
Copy-Item "C:\Wabash\Logfiles\mar1604.log.txt" -Destination "C:\Presentation"
(From: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/copy-item?view=powershell-7.1)

Fabio R.
- 393
- 3
- 15