Skip to main content
Kernzy
Inspiring
March 28, 2023
Question

Need help finding the owner of a file.

  • March 28, 2023
  • 1 reply
  • 1532 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.

Kernzy
KernzyAuthor
Inspiring
March 29, 2023

I'm really close to solving this, but I'm caught up on executing a PowerShell Script from my ExtendScript. 


Currently, I have the main ExtendScript that captures the date and the username of the files I want to open. When this information is captured I have a function that will write a new PowerShell script that can find all of the files from that desired day and by that user. The PowerShell script writes the file paths of those documents into a .txt file which is then passed back into the ExtendScript to be opened. The only issue is I have to run the PowerShell Script outside of Illustrator while the ExtendScript waits at on an alert to be clicked.

I've tried the link you sent @m1b, that method works in Photoshop, but not in Illustrator.
@CarlosCanto , I haven't tried your method yet because I've gotten so far already.

Anyone have any ideas?
I can share the script I have privately if needed.