[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 08-25-2006, 09:17 AM   #1 (permalink)
Senior Member
 
Join Date: Jan 2006
Posts: 4,140
5,730.67 NP$ (Donate)

Steve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond repute

Ethan Allen Fund Cancer Survivorship Special Olympics Protect Our Planet Autism Save a Life AIDS/HIV AIDS/HIV Marrow Donor Program Cancer Survivorship Protect Our Planet Child Abuse Alzheimer's Cancer Breast Cancer Multiple Sclerosis Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Zipping Files in a Directory with PHP?

Hello,

I have a directory of files that I sometimes update by uploading new files to it. I was looking for a way to run a PHP script that will take all the files in that directory and automatically zip them upon running the script. I was also considering learning how to create a cron job to do this, but I have no experience with cron jobs.

I'm not exactly sure what I'd search for to get what I'm looking for, so I was hoping someone here could shed some light on this issue for me. Any help would be very appreciated.

Thanks,
Steve
Steve is offline  
Old 08-25-2006, 09:30 AM   #2 (permalink)
NamePros Regular
 
NuPagady's Avatar
 
Join Date: Jul 2005
Location: Lithuania
Posts: 474
42.43 NP$ (Donate)

NuPagady is on a distinguished road


If your scripts are running on linux system, try this:
Code:
<?
exec("tar czf dir.tar.gz /dir");
?>
/dir is your directory.

To untar the archive, run this:
Code:
<?
exec("tar -zxvf dir.tar.gz");
?>
I use this method to make backups of my files, then I send everything to other server.

However, some webhosts have exec() command dissabled in their servers for security reasons.

Also, check this link:
http://php.net/zip


It should be easy to set up CronJob/CronTab if your host is running any of popular webhosting control panels (cPanel, Plesk, DirectAdmin...). You can do it easily in "Cron Job" or "CronTab" section in your control panel.

Last edited by NuPagady; 08-25-2006 at 09:37 AM.
NuPagady is offline  
Old 08-25-2006, 10:26 AM   #3 (permalink)
Senior Member
 
Join Date: Jan 2006
Posts: 4,140
5,730.67 NP$ (Donate)

Steve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond reputeSteve has a reputation beyond repute

Ethan Allen Fund Cancer Survivorship Special Olympics Protect Our Planet Autism Save a Life AIDS/HIV AIDS/HIV Marrow Donor Program Cancer Survivorship Protect Our Planet Child Abuse Alzheimer's Cancer Breast Cancer Multiple Sclerosis Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Thanks for your help, we'll see how that goes!
Steve is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 06:05 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85