Search code examples
javascriptdirectoryphotoshop-script

Get folder's attributes with Javascript in Photoshop


I want to get a folder's attributes, especially whether it is hidden. The script for Photoshop CC is written in JavaScript, and I am running Windows 10.

Unfortunately, the manual does not mention any method like attributes, therefore this code does not work:

var f = Folder('/c/Windows');
if (f.attributes & 2) {
    alert('Folder is hidden');
}

Does anybody know a way to at least find out whether a given folder is hidden?


Solution

  • Adobe's JavaScript Tools Guide has the details for the File and Folder objects. Unfortunately, it doesn't look like there is any attribute to expose the hidden status.

    You can have your script perform command line tasks, so if you know of a way through the OS command line to see this detail you could try having your script execute that command and getting the result.