Using Cygwin tar.exe on Windows
| From: | Brian Muldown | Date: | Tue, 18 May 2004 20:27:52 +0000 |
| Subject: | Using Cygwin tar.exe on Windows | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186500@lists.php.net to get a copy of this message | ||
I have a little application I have built that will create a tar.gz archive of a group of files and directories. It works flawlessly on FreeBSD, OSX and Debian Linux. I want it to work for Windows, but I am having some trouble.
I am simply using an exec call to the tar application:
exec('/path/to/tar -czf /path/to/myarchive.tar.gz file1 file2 dir1');
I have Cygwin installed on my Windows box (WINNT), and it includes a tar binary located in: C:\cygwin\bin\. When I use this command:
exec('C:\cygwin\bin\tar.exe -czf C:\path\to\myarchive.tar.gz C:\path\to\file1 C:\path\to\file2');
I get nothing - as in the exec returns NULL and no archive is created. I have confirmed this by providing the second parameter to exec() and dumping it - it's always NULL. I have two questions:
1. Why doesn't this work?
2. Is there a better/easier way to create a tar (or ZIP) archive on Windows (through PHP)? I will happily implement something else for those who must run inferior OS's.
Thanks,
-brian muldown