perl 脚本去掉 word 自定义属性

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/usr/bin/perl

use Archive::Zip;
use IO::File;
use Data::Dumper;
use XML::Simple;

my $buffer;
my $zip = Archive::Zip->new();

$zip->read('600601.docx');
$buffer = $zip->contents( '_rels/.rels' );

my $xml = XML::Simple->new()->XMLin($buffer, KeepRoot => 1);
$temp = $xml->{Relationships}->{Relationship};
my $count = 0;
foreach $temp_b (@$temp){
	if ( $temp_b->{Target} =~ /custom.xml$/ ){
		print $temp_b->{Target}."\n";
		delete $xml->{Relationships}->{Relationship}->[$count];
	}
	$count++;
}
my $xml = XML::Simple->new()->XMLout($xml,NoIndent => 1, RootName => '',XMLDecl => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');

$zip->contents( '_rels/.rels', "$xml" );
$zip->overwrite();