in reply to Using Archive::Tar with File::Find

Without looking at the code, I suspect it's because the found routine is being executed in many different current directories in both cases, but add_files is being handed the wrong path for the job in the second case. When you're in foo/bar, you can't open foo/bar/this.jpg, because it almost certainly doesn't exist. You have to open this.jpg.

Modern versions of File::Find can be told not to chdir, but that makes them pretty inefficient, so your first program version is probably the best anyway.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Using Archive::Tar with File::Find