My script needs to be altered so that it creates a folder with my .psd comp's file name. Anyone know how to do that?

  • 1
  • Question
  • Updated 3 years ago
I need to build a folder hierarchy on the Desktop and place files in it using a Photoshop action. for instance:

Master Folder Name
- High Res
-- HR_filename.jpg
-- HR_filename.png
- Low Res
-- LR_filename.jpg
-- LR_filename.png
- Master
-- master filename.psb

Using javascript (so that it's portable between Mac and Windows), is there an simple way do accomplish this? Perhaps a tutorial? I'm having a hard time finding good info in the forums - it keeps asking me to start a new post. Also, I have no experience with Javascript.

I found this script that works and does a lot of what I need. Is there a way to make the folder name "filename" inherit the file's name without the extension?

I also need to figure out how to save specific file types into those specific folders after the master folder has been named. I'm hoping I can accomplish this using actions, but they may not work with the custom folder names.

var target = Folder.selectDialog("Choose a target folder");
if(!(Folder(target+"/"+"filename")).exists)
{
new Folder(target + "/" + "filename").create();
new Folder(target + "/" + "filename" + "/hi-res").create();
new Folder(target + "/" + "filename" + "/lo-res").create();
new Folder(target + "/" + "filename" + "/master").create();
}
Photo of Steve Dorsey

Steve Dorsey

  • 8 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Steve Dorsey

Steve Dorsey

  • 8 Posts
  • 0 Reply Likes
var target = Folder.selectDialog("Choose a target folder");

var docname = app.activeDocument.name.substring(0, app.activeDocument.name.indexOf('.'));

if(!(Folder(target+"/"+"filename")).exists)
{
new Folder(target + "/" + docname).create();
new Folder(target + "/" + docname + "/hi-res").create();
new Folder(target + "/" + docname + "/lo-res").create();
new Folder(target + "/" + docname + "/simplified").create();
}