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

Ben W
Ben W used Ask the Experts™
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-24G
    |       +---40-1234-24G Folder
    |       |   +---Document fonts
    |       |   \---Links
    |       \---Art files
    |   \---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!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007
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 $ -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


That worked perfectly!!! Thank you so much @sirbounty!
Top Expert 2007

Happy to have helped. :^)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial