You could add an extra -e check right before you add the file, although the race condition will still exist. The better way to handle this would be to not be working in a directory at the same time you're zipping it, or using some other mechanism to lock, or perhaps exclude these temporary files from being considered for zipping in the first place... anyway, here's an (untested) idea for a "quick fix" that might help with the symptoms you describe:
find( sub { return unless -e $File::Find::name; eval { $zip->add($_, Name => $File::Find::name) or warn "Cannot add '$_' to zip file: $SimpleZipError\n"; 1 } or warn $@||'unknown error'; }, $data);
Note I'm using the "safer" form of checking eval for errors, see Bug in eval in pre-5.14
In reply to Re: SimpleZip If file doesn't exist
by haukex
in thread SimpleZip If file doesn't exist
by AlexandreG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |