# You'll need to put your own error checking logic in - this is bare bones # And I've not tested this - there may be bugs use TeamSite::Config; use TeamSite::WFtask; my $mount = TeamSite::Config::iwgetlocation('iwcgimount'); my $jobID = shift; my $taskID = shift; my $task = new TeamSite::WFtask($taskID); my $area = $task->GetArea(); my @files = $task->GetFiles(); undef $/; # Slup in entire files my ($totalFiles, $attemptedFiles, $successfulFiles) = (0, 0, 0); foreach my $file (@files) { $totalFiles++; next unless $file =~ /\.asp$/; # Or whatever logic you want here $attemptedFiles++; my $path = "$mount$area/$file"; open FILE, $path and do { my $input = <FILE>; close FILE; $input =~ s/FromThis/ToThat/g; open FILE, ">$path" and do { print FILE $input; close FILE; $successfulFiles++; }; }; } $task->CallBack(0, "Total files: $totalFiles, Attempted files: $attemptedFiles, Successful: $successfulFiles"); exit 0;
SYSTEM
su