jpratt Posted July 11, 2008 Share Posted July 11, 2008 I have the following code: $source = '/vservers/essmedcom/htdocs/downloader/software/' . $i; $target = '/vservers/essmedcom/htdocs/downloader/download/archive' . $i . '.zip'; $command = "/usr/bin/zip -r '$target' '$source'"; my problem is it zips the files i want to have at the root of the archive zip folder deep in the folders. I want to have it zip up files located at the software folder and place them at the root of the archive folder it creates. I tried this but didnt work to eliminate some of the folders deep: $source = '/vservers/essmedcom/htdocs/downloader/software/' . $i; $target = '/downloader/download/archive' . $i . '.zip'; $command = "/usr/bin/zip -r '$target' '$source'"; Any ideas? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/114194-zip-file-for-download/ Share on other sites More sharing options...
rhodesa Posted July 11, 2008 Share Posted July 11, 2008 first of all...for creating ZIPs, check out the PHP module: http://us3.php.net/zip, it's pretty slick. as for the zip command, try the -j switch (more switches here: http://amath.colorado.edu/computing/software/man/zip.html) $source = '/vservers/essmedcom/htdocs/downloader/software/' . $i; $target = '/vservers/essmedcom/htdocs/downloader/download/archive' . $i . '.zip'; $command = "/usr/bin/zip -rj '$target' '$source'"; Quote Link to comment https://forums.phpfreaks.com/topic/114194-zip-file-for-download/#findComment-587189 Share on other sites More sharing options...
Andy-H Posted July 11, 2008 Share Posted July 11, 2008 You have the folders chmoded to 0777, yes? Quote Link to comment https://forums.phpfreaks.com/topic/114194-zip-file-for-download/#findComment-587197 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.