[Solved] Powershell - Script to move all files from folders and subfolders into single folder
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.
To move all files under the source_path directory to the dest_path directory you can do this:
Get-ChildItem -Path <source_path> -Recurse -File | Move-Item -Destination <dest_path>
Here source_path like C:\Softwares and dest_path like C:\All Softwares
If you want to clear out the empty directories afterwards, you can use a similar command:
Get-ChildItem -Path source_path -Recurse -Directory | Remove-Item