################################# # # SetTitleProp.pl # # A quick and dirty script to set the 'title' property of a Structured + Storage file. # The files can be either on an NTFS partition, or could be MS Office +documents on # NTFS or FAT. # # To use it you must have installed the dsofile utility from the micro +soft site. Currently the # link to it is: # # http://support.microsoft.com/default.aspx?scid=kb;EN-US;q224351 # # But if the url is invalid then search for dsofile.exe, or knowledge +article 22435. # # ################################## use strict; use Win32::OLE; use File::Spec; my $PropertyReader = Win32::OLE->new('DSOleFile.PropertyReader', 'Quit +'); my $directory = "g:\\fileproptest"; opendir(DNAME, $directory) || die "Unable to open the requested direct +ory: $directory\n"; while( my $filename = readdir( DNAME ) ) { next if ($filename eq '.' or $filename eq '..'); my $fullfilename = File::Spec->catdir($directory,$filename); my $properties = $PropertyReader->GetDocumentProperties($fullfilen +ame) || die("Unable read file properties for '$fullfilename' ", Win +32::OLE->LastError()); if ( !$properties->{title} || length($properties->{title}) == 0) { print "File '$filename' --- Title not set setting to '$filenam +e'\n"; $properties->SetProperty('title', $filename); } else { print "File '$filename' --- Title property is set to '" . $pr +operties->{title} ."'\n"; } } closedir(DNAME);
In reply to SetFileProperties by mlutze
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |