In powershell I am trying to create a sub folder (directory) in multiple sub folders (directories) and move all the files in each into the newly create folder.
My directory structure is thus:
c:storesstore1 file1 file2 file3
c:storesstore2 file1 file2 etc...
What I want is to create a sub folder 2024 under each store folder and move the files into it.
E.g.
C:storesstore12024 file1 file2 file3
c:storesstore22024 file1 file2
I remember seeing commands with Get-childitem and Move, but cannot figure it out. I found instruction on how to create all the sub folders on here but not how to move the files.
dir -Directory | % {md ($_.FullName + '2024')}
Is what I used to create the subfolders from inside the c:stores directory, but where do I go from here and is there a way to combine the commands so it will create the folder and move the files in one step. I saw something using getChild but nothing I searched seemed to cover both steps.