1

I have a requirement in which we need to add/update generic property of any file like .doc, .pdf, .txt etc.. need to update properties like Title, Subject, Comments, Company..etc. I tried with below classes but doesn't work. we are running on windows platform.

java.nio.file.attribute.AclFileAttributeView;
java.nio.file.attribute.BasicFileAttributeView;
java.nio.file.attribute.DosFileAttributeView;
java.nio.file.attribute.FileAttributeView;
java.nio.file.attribute.FileOwnerAttributeView;
java.nio.file.attribute.PosixFileAttributeView;
java.nio.file.attribute.UserDefinedFileAttributeView;

I also gone through below related links but does not help : - How do I access "Details" ("Title", "Subject", etc.) of file properties in Perl or PowerShell script - Reading Windows file summary properties (title, subject, author) in Java

Can any one suggest any hint please.

Thanks, Ravi

Ravi Patel
  • 51
  • 3

1 Answers1

0

Hmm, there used to be a Summary tab in the Properties of any file in older versions of Windows, and it was based on an Alternate Data Stream as explained in one of the related questions. But I cannot find it in recent versions like Windows 7 or 10.

In those recent versions, the summary (now called Details) is only used for files having formats known to Windows and internally providing properties. Office files do, as JPEG or PDF ones, but text files do not. And for files that do provide those properties, you will have to find for every format you want to process a library or tool able to read and set those properties.

Serge Ballesta
  • 143,923
  • 11
  • 122
  • 252
  • Thanks for your reply Serge. I think there should be some windows API available to do the same. Which can be integrated in DLL to call from JAVA-JNI. Anybody has any such idea ? OR should I need to use file format specific implementation to do the same, like to update office files, pdf, image etc.. – Ravi Patel Feb 16 '18 at 11:16