I have a PowerShell function that moves files and folders from one directory to another. I want to be able to make sure neither value for $fromFolder or $toFolder is empty or null. Not sure how it would work with two parameters.
function Move-Folders {
gci $fromFolder -Recurse | ForEach-Object { Move-Item $_.FullName $toFolder }
ii $toFolder
}
Move-Item. There's no need to browse withgcias you move everything without filtering so just useMove-Item, it will be more accurate. However I have provided an answer with how to validate your parameters.