Enlightened ones:
The zip command string below works as expected from the commandline on both Solaris and Mac OS X: the paths are excluded and I get a zip file containing only the files matching *.$fileext. But when I run the same command via Perl system() in a CGI script, the zip file contains empty directories for the full path from host root down to htdocs, with the files in the last directory.
Both the commandline and system() cases send the expected STDOUT to the file $joblog, and nothing shows up in the file $joberrors.
This command line excludes directories as advertised in man zip:
# /usr/bin/zip -D $zipfile $somepath/*.$fileext 1>$joblog 2>$joberrors
This system call does not:
$zipcommand = "/usr/bin/zip -D $zipfile $somepath/*.$fileext 1>$joblog + 2>$joberrors"; system("$zipcommand");
I noticed a similar question with tar on stackoverflow.com: How do i make a “system call to tar files(along with exclude tag)” to work in Perl.
Is there something about passing commandline switches that I am missing?
In reply to Why doesn't system("zip -D") exclude directories? by YuTsun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |