I'm trying to write a tagging system in Powershell. I would like to be able to set a 'tag'
of my choice in a file for example by using the 'title'
field as I don't use it. The files I'd like to tag are a mixture of photos/videos and text.
I've found it quite easy to read/get extended file attributes as there are multiple examples available on the net, however I'm finding it extremely difficult to find examples of modifying or writing extended file properties; especially in Powershell.
I have managed to write 'titles'
to files using taglib-sharp but this seems to have problems with various photos and there is not much info available for troubleshooting. Plus it only deals with audio/video/photo files.
This is the code I have to read the title (from a test photo):
$path = 'C:\temp\photo.jpg'
$shell = New-Object -COMObject Shell.Application
$folder = Split-Path $path
$file = Split-Path $path -Leaf
$shellfolder = $shell.Namespace($folder)
$shellfile = $shellfolder.ParseName($file)
$shellfolder.GetDetailsOf($shellfile, 21)
Can anyone tell me how I can I update this attribute and then write/save it to the file?