Copy link to clipboard
Copied
I have 75 group folders in the layer window, each of those groups is named and contains 32 layers. I am trying to use the 'Export Layers to Files' built in script to export everything, however it is losing the group folder structure and just putting all the exported files in one folder on the had drive with really long numbers before the layer names. I need to maintain the group folder structure on export, how can I do this? I am using PS 2019 on a Mac with OSX 10.14.6 Thanks for your help in advance!
Copy link to clipboard
Copied
Have a look at the script "Export Layers To Files.jsx" It seems to save file with the file name the script sets the variable "fileNameBody" to. Add code to add the layer set name the the beginning of that variable for the file name. You may be able the use the Layer's object parent I would think the layer set name would be its parent or the container's name would be the layer set name.
The script code now looks like this:
var fileNameBody = fileNamePrefix;
fileNameBody += "_" + zeroSuppress(i, 4);
fileNameBody += "_" + layerName;
fileNameBody = fileNameBody.replace(/[:\/\\*\?\"\<\>\|]/g, "_"); // '/\:*?"<>|' -> '_'
Try adding the layer object being process Layer.parent before layerName to the variable you may need to find where layerName is set to see what layer object being processed is. You may need to add it before any sequence number if you need to sort the output folder so layer in a group sort together, I do not know exactly how the script process the document layer stack.
The set name may not be good for what you want to do. Like layer names do not need to be unique layer group name need not be unique there can be more the one group in a document with a name "X".
Copy link to clipboard
Copied
After doing some considerable digging on the old internet I found this script that does everything I needed and worked on the first try, it even functions faster than the built in script!
https://github.com/hsw107/Photoshop-Export-Layers-to-Files-Fast/blob/master/README.md
Copy link to clipboard
Copied
Just wanted to say thanks for this! This saved me out here in 2024!
Copy link to clipboard
Copied
Apart from custom scripts for specific layer saving tasks, other general alternatives also include:
https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Saver.jsx
https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Saver%20Plus.jsx
https://github.com/mechanicious/photoshopCompositionComposer