Hi

I was given this by a colleague to split files in a powershell format but aint got a clue on powershell or what it is or how it even works. Sort of know how .vbs /.cmd works.

Am I able to convert to .CMD or .VBS script as I need it to show whats happening as it splitting files.

This will get all files of your main folder, and move them into 1000MB subfolders.

# Replace with your base folder's path
$baseFolder = "C:\Users\g\Downloads\test"

# Replace with the desired value for the subfolders to create
$maxSubFolderSize = 1000MB

# Get all files contained in your base folder (could use the -recurse switch if needed)
$allFiles = Get-ChildItem $baseFolder

# Setting the subfolders naming convention : a name and a suffix
$baseSubFolder = "SubFolder-"
[int]$index = 0

# Creating the first subfolder
$subFolder = "SubFolder-" + "$index"
New-Item -Path $subFolder -Type Directory -Force

# Now processing the files
foreach ($file in $allFiles)
{
# Evaluating the size of the current subfolder
$subFolderSize = ((Get-ChildItem $subFolder -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB)

# If the current subfolder size is greater than the limit, create a new subfolder and begin to copy files in it
if([int]$subFolderSize -gt [int]$maxSubFolderSize/1MB)
{
$index++
$subFolder = $baseSubFolder + $index
New-Item -Path $subFolder -Type Directory -Force
Write-Verbose -Message "Created folder $subFolder"
Move-Item $file.FullName -Destination $subFolder
}
# If the current subfolder is not yet greater that the limit, continue copying files in it
else {
Move-Item $file.FullName -Destination $subFolder
}
}

Any idiot proof help greatly appriciated in advance