Answered
Help with script that select Layers based on string then move selected layers to specific folder.
Hi,
I don't know Java so your help is greatly appreciated!
I want to sort my layers into folders based on naming convention.

The closest script I found was this from stackoverflow, but it is missing selecting layers, and moving them.
JavaScript string wildcards for photoshop
// group layer vegetables
var allLayers = new Array();
var artLayers = new Array();
var theLayers = collectAllLayers(app.activeDocument, 0);
var artLayerNames = "";
// loop over art layers backwards
for (var i = artLayers.length -1; i >= 0 ; i--)
{
var temp = artLayers[i];
var regEx = new RegExp(/t/gim);
if (temp.match(regEx))
{
// if the layer contains the letter "t" show it!
alert(temp);
}
artLayerNames+= artLayers[i] + "\n";
}
// print out all layers
alert(artLayerNames);
// function collect all layers
function collectAllLayers (theParent, level)
{
for (var m = theParent.layers.length - 1; m >= 0; m--)
{
var theLayer = theParent.layers[m];
// apply the function to layersets;
if (theLayer.typename == "ArtLayer")
{
// get the art layers
artLayers.push(theLayer.name);
}
else
{
allLayers.push(level + theLayer.name);
collectAllLayers(theLayer, level + 1)
}
}
}
