fred
October 9, 2023, 3:05pm
1
Hello,
This used to work with Extendscript: > parentFolder = myFolder.parent;
How do I get the parent folder using UXP?
const fs = require(“uxp”).storage.localFileSystem;
const myFolder = await fs.getFolder();
const parentFolder = myFolder.parent; < return undefined
Thank you,
fred
You can use getEntryFromUrl()
and pass it an appropriately mutated version of the entry
’s nativePath
.
Here’s an similar example - note the need for manifest v5 and the appropriate access permissions set there in.
fred
October 10, 2023, 2:43pm
3
Hi Timothy,
Thank you for your help. I managed to get the values by using:
const fs = require(“uxp”).storage.localFileSystem;
const myFolder = await fs.getFolder();
Path:
parentFolder = path.dirname(myFolder.nativePath);
Name:
const parentFolderName = path.basename(parentFolder);
1 Like
That’s ok if you just want it as a string, if you want to interact with the folder use the method above.