protected function doWork()
    {

        // These "slots" allow filters to retrieve information about the currently-being-process files
        $fromSlot = $this->getRegisterSlot("currentFromFile");
        $fromBasenameSlot = $this->getRegisterSlot("currentFromFile.basename");

        $toSlot = $this->getRegisterSlot("currentToFile");
        $toBasenameSlot = $this->getRegisterSlot("currentToFile.basename");

        $mapSize = count($this->fileCopyMap);
        $total = $mapSize;

        // handle empty dirs if appropriate
        if ($this->includeEmpty) {
            $count = 0;
            foreach ($this->dirCopyMap as $srcdir => $destdir) {
                $s = new PhingFile((string) $srcdir);
                $d = new PhingFile((string) $destdir);
                if (!$d->exists()) {
                    // Setting source directory permissions to target
                    // (On permissions preservation, the target directory permissions
                    // will be inherited from the source directory, otherwise the 'mode'
                    // will be used)
                    $dirMode = ($this->preservePermissions ? $s->getMode() : $this->mode);

                    // Directory creation with specific permission mode
                    if (!$d->mkdirs($dirMode)) {
                        $this->logError("Unable to create directory " . $d->__toString());
                    } else {
                        if ($this->preserveLMT) {
                            $d->setLastModified($s->lastModified());
                        }

                        $count++;
                    }
                }
            }
            if ($count > 0) {
                $this->log(
                    "Created " . $count . " empty director" . ($count == 1 ? "y" : "ies") . " in " . $this->destDir->getAbsolutePath()
                );
            }
        }

        if ($mapSize == 0) {
            return;
        }

        $this->log(
            "Copying " . $mapSize . " file" . (($mapSize) === 1 ? '' : 's') . " to " . $this->destDir->getAbsolutePath()
        );
        // walks the map and actually copies the files
        $count = 0;
        foreach ($this->fileCopyMap as $from => $toFiles) {
            if (is_array($toFiles)) {
                foreach ($toFiles as $to) {
                    $this->copyToSingleDestination(
                        $from,
                        $to,
                        $fromSlot,
                        $fromBasenameSlot,
                        $toSlot,
                        $toBasenameSlot,
                        $count,
                        $total
                    );
                }
            } else {
                $this->copyToSingleDestination(
                    $from,
                    $toFiles,
                    $fromSlot,
                    $fromBasenameSlot,
                    $toSlot,
                    $toBasenameSlot,
                    $count,
                    $total
                );
            }
        }
    }