-1

I'm trying to overwrite an existing file with new metadata on python. So, I'm looking for a method that we can apply to any type of files (doc, docx, pdf, pptx, xlsx and so on, and so on)

I tried to do this using os.setxattr as it was here but I don't want to add additional attributes Also I have to say that the metadata was obtained using win32com.client. So I think maybe we can use this for my task

Thanks

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 2
    What metadata are you trying to change? – Barmar Nov 10 '22 at 22:41
  • @Barmar, It depends on type of file. But basicly something like: author, created, owner... – HlebnoePole Nov 10 '22 at 23:35
  • 1
    I don't think the functions for updating metadata care about the type of file. – Barmar Nov 10 '22 at 23:46
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Сергей Кох Nov 11 '22 at 10:02
  • As far as WindowsAPI concerned, [Property System](https://learn.microsoft.com/en-us/windows/win32/properties/property-system-code-samples) enables us to [read and write file property values](https://github.com/microsoft/Windows-classic-samples/blob/7cbd99ac1d2b4a0beffbaba29ea63d024ceff700/Samples/Win7Samples/winui/shell/appplatform/PropertyEdit/PropertyEdit.cpp#L119). – YangXiaoPo-MSFT Nov 14 '22 at 07:13

1 Answers1

0

There have been numerous attempts at this desire over the centuries.

Windows uses several means like AD or other file meta-attachments

Earlier versions had better access to edit details

  1. Open the folder that contains the file you want to change.
  2. Right-click the file, and then click Properties.
  3. In the Properties dialog box, click the Details tab, click the properties box that you want to change, type a word or phrase, and then click Apply. (If you don’t see any text for the property you want to add, point to the place where you would expect to see text, and a box will appear.)

enter image description here

Perhaps the best known / effective as it was simple and possible across all 8.3 platforms, was the 4th Disk Operating System descript.ion file. Often used by File manglers like X-tree, Opus, TC etc, here described as

"Filename.extension" any info one deems worthy to keep
(usually: SUBJECT, Poster, Date)
It's a plain text file.

It could be extended by anti-virus tools to hold CRC/MD5/SHA data to guard against virus file mods. Sadly, it fell into despair as it was not an agreed format.

Basically, unless supported by the prime OS manufacturer it did not gain traction.

K J
  • 8,045
  • 3
  • 14
  • 36