I have different project folders that all have the same set of folders (all folders are not named exactly the same unfortunately). I’ve been trying to use the following code below to move them but keep getting an error:
#Wildcards used in path because folder names not all standardized, #I set my location to the project root folder. #Sets variable to project folder path $ProjectRootFolder=Get-Location #Moves desired files to Admin Folder Move-Item .\Briefs,'.\Budget Formulation','.\Fact Sheets',.\Images,.\Reports -Destination .\*Admin* #change directory, goes through all FYs for the Budget Formulation folder. These folders and it's subfolders were moved with the #previous code cd $ProjectRootFolder"\*Admin\*Budget Formulation*\*20*\Contract formulation documents" Move-Item ".\Phasing Plan',.\Proposals,.\SOW,'.\SRRB Quad chart','.\UFR - CYD' -Destination $ProjectRootFolder"\*Admin*\*Budget Formulation*\*20*" cd $ProjectRootFolder"\*Admin\*Budget Formulation*\*19*\Contract formulation documents" Move-Item ".\Phasing Plan',.\Proposals,.\SOW,'.\SRRB Quad chart','.\UFR - CYD' -Destination $ProjectRootFolder"\*Admin*\*Budget Formulation*\*19*" cd $ProjectRootFolder"\*Admin\*Budget Formulation*\*18*\Contract formulation documents" Move-Item ".\Phasing Plan',.\Proposals,.\SOW,'.\SRRB Quad chart','.\UFR - CYD' -Destination $ProjectRootFolder"\*Admin*\*Budget Formulation*\*18*"
ERROR
Move-Item : A positional parameter cannot be found that accepts argument '\*Admin*\*Budget'. At line:12 char:1 + Move-Item ".\Phasing Plan',.\Proposals,.\SOW,'.\SRRB Quad chart','.\U ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Move-Item], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.MoveItemCommand
Is it all the wildcards? I’m not very experienced with powershell or coding in general. Any other info needed please let me know.