Rename File in File System

Hi there,
final update on that:

Since the renameEntry() function is not yet available in the official PS version, I’ve now solved it using moveTo() within the same folder with renaming as workaround:

  var persistentFolderToken = await localStorage.getItem("persistent-token"); 
  var folder = await require('uxp').storage.localFileSystem.getEntryForPersistentToken(persistentFolderToken);
  var entry = await folder.getEntry("MyFile.tif"); 
  await entry.moveTo(folder, { newName: "MyFile.abc", overwrite: true })

btw: there is a typo in the documentation:
it says

await someFile.moveTo(someFolder, {newName: 'novel.txt', {overwrite: true})

but should be

await someFile.moveTo(someFolder, {newName: 'novel.txt', overwrite: true})
1 Like