Trying to index and search for a file within 8K files and 2K folders..
Is there a simple Powershell script that can move all files from folders and/or subfolders into one main folder?
don't need to delete the empty folders but would help.
Click on the Drop stack tab to open it. Now we can drag and drop each file we want to copy into the drop stack area. Once we have all the files we want to copy in the drop stack area, we can open the folder we want to copy to, and simply drag and drop all the files from the drop stack to that folder.
The fourth example under help -Examples Move-Item
is close to what you need. To move all files under the source
directory to the dest
directory you can do this:
Get-ChildItem -Path source -Recurse -File | Move-Item -Destination dest
If you want to clear out the empty directories afterwards, you can use a similar command:
Get-ChildItem -Path source -Recurse -Directory | Remove-Item
Use .parent
for the parent dir. It can be used recursively: .parent.parent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With