Skip to main content
Kernzy
Inspiring
March 28, 2023
Question

Need help finding the owner of a file.

  • March 28, 2023
  • 1 reply
  • 1541 views

Hey y'all!


I'm attempting to create a script to help return all of the file names of PDFs created by a user on a specific date. I'm running into some issues finding a way to return the owner's name. I couldn't find any related posts or any documentation online so I'm starting to think that this might not be possible. Let me know if you need any more information to take a crack at this!

 

Here is what I have:
*I left the folder line open so you can adjust it to use your own*

 

var folder = new Folder("C:\\Users\\Kernzy\\Downloads\\DailyTester"); // replace with the path to your folder
var files = folder.getFiles();

for (var i = 0; i < files.length; i++) {
  var file = files[i];
  if (file instanceof File) {
    var owner = file.owner;
    var created = file.created;
    alert("File: " + file.name + "\nOwner: " + owner + "\nCreated: " + created);
  }
}

 

 
Current Alert:
File: Tile.pdf

Owner: undefined

Created: Tue Mar 28 2023 10:13:19 GMT-0500

Goal Alert:
File: Tile.pdf

Owner: Kernzy

Created: Tue Mar 28 2023 10:13:19 GMT-0500

This topic has been closed for replies.

1 reply

Met1
Legend
March 28, 2023

If it's not in the metadata where are you expecting to pull it from?

Kernzy
KernzyAuthor
Inspiring
March 28, 2023

For this example I'm trying to pull the 'AD\krburns'

I was thinking the information might be available somewhere if I can find it here.
I'm able to pull the information via PowerShell, but I wasn't sure if there was a way to pull that same info with JavScript or ExtendScript directly.

CarlosCanto
Community Expert
Community Expert
March 28, 2023

file owner is not accessible to illustrator api, you could get it with vbs but if you already have a powershell script, then use that.

 

your jsx script would write a vbs file on the fly and run it via file.execute();

 

here's a vbs script that gets the file owner

https://www.vbsedit.com/scripts/security/ownership/scr_1386.asp