#!c:\iw-home\iw-perl\bin\iwperluse File::Find;$start = "Y:/default/main/branch/WORKAREA/Content/";find(\&wanted, $start);foreach $file(@list) {if (!($file=~ m|\.html$|) ) { next;}my $html= _getHTML($file);if ($html =~ m|(.*)|igsm) {print "$file, $1\n";}}sub _getHTML{ my($file) = @_; open (HTML, "$file") || die "Cannot open $file for reading:$!"; { local $/ = undef; $html= ; } close HTML; return $html;}sub wanted {-f && push(@list, $File::Find::name);}
Hi,I have been reading the threads regarding iwextattr clt to extract metadata from a file and someone posted a script that works recursively. However I am new to perl and am having a hard time. We work on TS 6.7.1/Unix platform. I am trying to extract the Title metatag from thousands of files. Is there a simple perl script that someone can help me with. Again, I know this question has been asked before, but I'm new to perl and I'm new to running iwperl commands. Any help would be appreciated. Thanks.Claire
Claire, since you know iwextattr would work for you, what help are you exactly looking for?
#!c:\iw-home\iw-perl\bin\iwperluse File::Find;use TeamSite::Config;(my $iwhome = TeamSite::Config::iwgethome()) =~ tr|\\|/|;(my $iwmount = TeamSite::Config::iwgetmount()) =~ tr|\\|/|;my $start = "Y:/default/main/branch/WORKAREA/Content/";my $key="EXTENDED ATT TO GET";find(\&wanted, $start);foreach $file(@list) { $file=~ s/^$iwmount//; my $cmd = "$iwhome/bin/iwextattr -g \"$key\" \"$file\""; chomp(my $value = `$cmd 2>&1`); if ($value) { print "$file,$value\n"; }}sub wanted {-f && push(@list, $File::Find::name);}
HiNipper, I just read your latest post...thanks. I will work with the script and let you know. Thanks again..and thanks to everyone for responding to my post.Claire
I have attached the dcr that we are using, I just want to extract the TeamSite/Metadata/TITELE extended attribute from all the files and write it to a text file. The title is duplicated from the dcr to become a TeamSite extended attribute. My question is, and again I'm new to perl, I want to know how to do a "get" for an extended attribute...do I need to include the iwextattr? My apologies for the lame question, but I just want to make sure I understand how this works.
It worked! Thank you so much, I really appreciate this.Claire