Not all metadata properties extracted from a file are marked with tags. Some file formats and metadata standards allow adding fully custom properties that can’t be properly tagged by the library since their purpose is not clearly defined in the appropriate format/standard specification. In such cases, you can use the name of the property to locate and remove it. The following example demonstrates some advanced usage scenarios of the GroupDocs.Metadata search engine allowing to remove metadata properties.
Filefolder=newFile(Constants.InputPath);for(Filefile:folder.listFiles()){try(Metadatametadata=newMetadata(file.getAbsolutePath())){if(metadata.getFileFormat()!=FileFormat.Unknown&&!metadata.getDocumentInfo().isEncrypted()){System.out.println();System.out.println(file.getName());// Remove all mentions of any people contributed in file creation// Remove a custom property with the specified nameintaffected=metadata.removeProperties(newFallsIntoCategorySpecification(Tags.getPerson()).or(newWithNameSpecification("CustomProperty")));System.out.println(String.format("Affected properties: %s",affected));metadata.save(Constants.OutputPath+"output."+FilenameUtils.getExtension(file.getName()));}}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: