Is there a way to batch move one sub folder into another for over 200 folders?

I have a root folder C:\Users\username\Desktop\FolderStructure_New that contains 215 folders. Each folder is named for a SKU. In each folder, there is a folder for the revision level. Each revision folder contains a folder titled "Art files" and a folder that is a collect from Adobe InDesign, titled as "[Revision-name] Folder" (see below for example). Most of the files share the prefix "PC-", but a portion have the prefix "40-".

The folder structure is like this:

 
  +---40-1234-24
    |   \---40-1234-24G
    |       +---40-1234-24G Folder
    |       |   +---Document fonts
    |       |   \---Links
    |       \---Art files
     +---PC-5678-24
    |   \---PC-5678-24J
    |       +---Art files
    |       \---PC-5678-24J Folder
    |           +---Document fonts
    |           \---Links

Open in new window



----------
What I need to do is move each "[Revision name] Folder" into it's corresponding "Art files" folder. I would love to be able to do this with some sort of batch processing. Also, if it's possible to make the process work on more than one directory (which will also be on my desktop), that would be awesome.

Any help would be immensely appreciated!
Ben WAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sirbountyCommented:
Firstly, do I have your folder structure correct? layout
If so, then this powershell script should work.  Remove the -whatIf parameter after you've confirmed the results are as desired.

$startingFolder = 'F:\test'
$folderStructure = dir $startingFolder -Recurse
foreach ($folder in $folderStructure | where {$_.Attributes -eq 'Directory' -and $_.name -like '* Folder'}) {
    $parent = $folder.Parent
    $target = "$($parent.FullName)\Art Files"
    if (Test-Path $target) {
        write-host "Attempting to move $($folder.FullName) to $target"
        Move-Item -Path $folder.FullName -Destination $target  -WhatIf
    }
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ben WAuthor Commented:
That worked perfectly!!! Thank you so much @sirbounty!
0
sirbountyCommented:
Happy to have helped. :^)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.