YuTsun has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why doesn't system("zip -D") exclude directories?
by ikegami (Patriarch) on May 05, 2010 at 18:01 UTC | |
by YuTsun (Initiate) on May 05, 2010 at 18:58 UTC | |
by ikegami (Patriarch) on May 05, 2010 at 22:27 UTC | |
by YuTsun (Initiate) on May 05, 2010 at 23:34 UTC | |
by choroba (Cardinal) on May 05, 2010 at 21:39 UTC | |
by almut (Canon) on May 05, 2010 at 22:48 UTC | |
|
Re: Why doesn't system("zip -D") exclude directories?
by marto (Cardinal) on May 05, 2010 at 17:42 UTC | |
by YuTsun (Initiate) on May 05, 2010 at 18:37 UTC |