Usage Examples
pwsh ./MoveFile.ps1 json
This will move all json files, recursively from Current Folder and Move it to ../json/* folder
# define a count variable | |
$count = 0 | |
# get first argument | |
$source = $args[0] | |
mkdir("../$source") | |
Get-ChildItem -Recurse -Filter "*.$source" | ForEach-Object { | |
# $json = Get-Content $_ -Raw | ConvertFrom-Json | |
# $json | ConvertTo-Json | Set-Content $_ | |
Write-Host "Move to: ../$source/$($_.FullName | Split-Path -Leaf)" | |
$_.MoveTo("../$source/$($_.FullName | Split-Path -Leaf)") | |
$count++ | |
} | |
Write-Host "Total: " $count |