Moves all files in given directory and subdirectories to single folder.
PS> .\MoveFilesToSingleDirectory.ps1 -Path ".\src" -DestDir ".\dst" -Filter *.bmp,*.avi
All parameters are optional
-Path
- source directory path, when not provided, script's directory is taken
-Dest
- destination directory path, when not provided, -Path
directory is taken
-Filter
- filter file types to be moved, when not provided, default are taken
When there are duplicates, files will be removed and __{i}_
will be appended to the beginnig of the each duplicated file.
###GIVEN
+-- rootDir
| `-- file-duplicate.txt
| +-- dir1
| | `-- file-1.txt
| | `-- file-duplicate.txt
| | +-- dir1-1
| | | `-- file-1-1.txt
| | | `-- file-1-2.txt
| +-- dir2
| | `-- file-2.txt
| | `-- file-duplicate.txt
###RESULT
+-- destDir
| `-- file-duplicate.txt
| `-- __1_file-duplicate.txt
| `-- __2_file-duplicate.txt
| `-- file-1.txt
| `-- file-1-1.txt
| `-- file-1-2.txt
| `-- file-2.txt