Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Return a file's owner

Subject: Return a file's owner

From: Robert

Date: 10 Apr, 2013 18:10:12

Message: 1 of 4

Does anyone know how to retrieve a file's owner (aka creator, author, etc.) on a Windows 7 platform with MATLAB 2013a? Googling around a bit, I thought that I could use java.nio.file.Files.getOwner(fullfile(<path>,<filename>), but when I try that, I get an error (Undefined variable "java" or class "java.nio.file.Files.getOwner"). Any other ideas?

Thanks,

Robert

Subject: Return a file's owner

From: Yair Altman

Date: 11 Apr, 2013 09:11:13

Message: 2 of 4

"Robert " <rseltzer@borgwarner.com> wrote in message <kk49u4$l38$1@newscl01ah.mathworks.com>...
> Does anyone know how to retrieve a file's owner (aka creator, author, etc.) on a Windows 7 platform with MATLAB 2013a? Googling around a bit, I thought that I could use java.nio.file.Files.getOwner(fullfile(<path>,<filename>), but when I try that, I get an error (Undefined variable "java" or class "java.nio.file.Files.getOwner"). Any other ideas?
>
> Thanks,
>
> Robert

This class was only added in Java7 - Matlab still uses Java 6 where it is not available. Try searching the web for Java6 solutions, or else try installing Java 7 and connect it to your Matlab.

Yair Altman
http://UndocumentedMatlab.com
Read my Matlab-Java programming book
 

Subject: Return a file's owner

From: james bejon

Date: 11 Apr, 2013 09:45:08

Message: 3 of 4

If you're on Windows, you should just be able to return the results of a "dos" call:

doc dos
And see the "\Q" arg for http://www.computerhope.com/dirhlp.htm

Subject: Return a file's owner

From: Robert

Date: 11 Apr, 2013 12:32:08

Message: 4 of 4

Thanks for the info! The DOS command worked just fine. It even works with a UNC path even though MATLAB's DOS Help documentation says it's not supported. The only negative is I have to parse the returned string which isn't really a big deal. This method will definately work for now. Once MATLAB moves to Java 7, then perhaps the java.nio.file.Files.getOwner() function will work.

Thanks,

Robert

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us