I am using below script which create csv files in batches ex:Batch1,Batch2, but how should modify this script so it will create create folder and insert all batch files inside that.
Tried this but not working
$BatchNr = 1
Import-Csv -Path .\Master.csv |Create-Batch -Size 50 |ForEach-Object {
$_ |ForEach-Object {
$_ # do something with each item in the batch of 50
} $files | Export-Csv ".\Batch$BatchNr.csv"
ForEach ($file in $files)
{
$folder = New-Item -type directory -name $file.BaseName;
Move-Item $file.FullName $folder.FullName;
}
$BatchNr++
}