Copy link to clipboard
Copied
Hi people,
Until today and on all platforms, the low-level ExtendScript method Folder.prototype.create() was able to create a full path of non-existent subfolders within some root folder. For example, with the code
var myFolder = new Folder( Folder.myDocuments + '/dir1/dir2/dir3' );
myFolder.create();
you were obtaining the creation of all required subfolders (dir1, dir2, dir3) in case of non-existence. This behavior was consistent across all versions of ExtendScript that we knew of, and on all systems.
As of InDesign 20.1 (not 20.0.x), and specifically on macOS, the above code will not always produce the desired result. In fact, only the dir1 folder will be created (if it does not exist), or only dir2 (if dir1 exists but not dir2), and so on. In other words, myFolder.create() only creates the highest missing folder in the hierarchy—so it will only work correctly if all parent folders were already existing.
A particular side effect is that, even if no errors are reported during the operation, a successfull myFolder.create() does not guarantee that myFolder.exists is then true!
It's easy to imagine countless scenarios where this change (which in my opinion is a pure bug) will significantly affect the behavior of your scripts, including those already in circulation.
Until Adobe fixes this issue or provides us with more details, it is possible to ‘patch’ the faulty method and restore its consistency. I just implemented this fix in the IdExtenso framework, but since I know that an infinitesimal number of developers use it, here the basic solution I suggest to you:
//==========================================================================
// [FIX250129] Folder.prototype.create()
// Fixes the Folder creation bug in macOS + ID 20.1
//==========================================================================
if( 'Macintosh'==File.fs && 20.1 <= parseFloat(app.version) )
//----------------------------------
// Provides a patch to the method `Folder.prototype.create` so
// that it still creates the folder including all missing parents
// at the location given by the path property. Returns true if the
// folder was created successfully.
{
// Backup original method.
Folder.prototype.__create__ = Folder.prototype.create;
// Patch.
Folder.prototype.create = function create()
{
return this.exists ||
(
( null===this.parent || this.parent.create() )
&& this.__create__()
);
};
}
Hope that helps.
Best,
Marc
2 Correct answers
Hi,
Thank you for reporting the issue. We have been able to reproduce the issue and it is currently under investigation.
—
Adobe InDesign Team
The fix for this issue is available in the InDesign PreRelease build(v20.2.0.036) and above.
Please check if the issue is now resolved.
Download/Update the latest InDesign PreRelease build in Creative Cloud under the “Prerelease” category(Refer to “Prerelease_CreativeCloud.png” for reference)
Please apply to the InDesign PreRelease in case you don’t have access to the InDesign PreRelease build – https://www.adobeprerelease.com/beta/C6DFA254-C40C-4EEB-8F6D-F4AEDA2E6171
If you still encoun
...Copy link to clipboard
Copied
Does it work recurently? Will this piece of code create all subfolders?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi @Marc Autret I noticed my scripts failing, too, but hadn't had time to look into it. Thanks for posting here as well as a nice workaround! Is there a bug report to vote on?
- Mark
Copy link to clipboard
Copied
Insane code as always!
Thanks Marc.
Copy link to clipboard
Copied
Hi all, for what it's worth, I've created a bug report on uservoice. Please vote!
- Mark
Copy link to clipboard
Copied
Hi,
Thank you for reporting the issue. We have been able to reproduce the issue and it is currently under investigation.
—
Adobe InDesign Team
Copy link to clipboard
Copied
thank you....been going nuts trying to solve!!!!!
Copy link to clipboard
Copied
The fix for this issue is available in the InDesign PreRelease build(v20.2.0.036) and above.
Please check if the issue is now resolved.
Download/Update the latest InDesign PreRelease build in Creative Cloud under the “Prerelease” category(Refer to “Prerelease_CreativeCloud.png” for reference)
Please apply to the InDesign PreRelease in case you don’t have access to the InDesign PreRelease build – https://www.adobeprerelease.com/beta/C6DFA254-C40C-4EEB-8F6D-F4AEDA2E6171
If you still encounter any issues, please drop a mail to sharewithID@adobe.com.
—
Adobe InDesign team
Copy link to clipboard
Copied
@Sanyam Talwar thank you! I can confirm on MacOS 15.3.1, ID 20.2 the bug is fixed!
- Mark

