Question:Zip file

Status
Not open for further replies.

sonic

New Member
Messages
77
Reaction score
0
Points
0
Hi ,,,

Can we zip files on the cpanel?

It is easer to download files .
 
Last edited:

MicrotechXP

New Member
Messages
7,644
Reaction score
0
Points
0
No I don't think you can in cPanel. You can download whatever you need and .zip it and upload it via FTP though.
 

dest581

New Member
Messages
348
Reaction score
0
Points
0
You could probably find a script that would zip up everything in its directory. Depending on how many files you have, though, that could result in you using way too many resources.
 

Micro

Retired staff <i> (11-12-2008)</I>
Messages
1,301
Reaction score
0
Points
36
If you want to zip directories you can do this:

<?php
exec("zip -r dirtozip zippeddir");
?>

Put that in a file called "zip.php" and then put it above the directory you want to zip, it should zip it up into a zip file called zippeddir.zip above the dir you zipped.
 

sonic

New Member
Messages
77
Reaction score
0
Points
0
I thank everyone for their help

Mr Micro ,,

I will try to do that ...
Edit:
If you want to zip directories you can do this:

<?php
exec("zip -r dirtozip zippeddir");
?>

Put that in a file called "zip.php" and then put it above the directory you want to zip, it should zip it up into a zip file called zippeddir.zip above the dir you zipped.


Nothing happened when I run the file !!

Is there any thing to do with this php file?
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
did you change "dirtozip"
 

sonic

New Member
Messages
77
Reaction score
0
Points
0
Yes, I changed it to the folder which I want to zip .
 

Micro

Retired staff <i> (11-12-2008)</I>
Messages
1,301
Reaction score
0
Points
36
erm, maybe not then. Can't remember other than that -- sorry :(
 

xai_master

Member
Messages
94
Reaction score
0
Points
6
With cPanel you can extract ZIP file but you cant zip a file using cPanel
 
Last edited:

S_W_A_T

New Member
Messages
292
Reaction score
0
Points
0
<?php

$zipme = "/home/yr_cpanel_username_here/public_html/pics.zip";
$targetfolder = "/home/yr_cpanel_username_here/public_html/pictures";

$lines = shell_exec("zip -r ".$zipme." ".$targetfolder);

echo $lines;
exit;

?>

Replace $zipme to the directory you want the zipped file to be put after zipping.
Replace $targetfolder to the directory of the folder you wish to be zipped.
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
i don't think that we are supposed to be using the shell, shell_exec, or exec on the servers but, you would half to talk to corey about that
 

swirly

Active Member
Messages
1,930
Reaction score
0
Points
36
why dont you download it, zip it, then upload it back?
 

sonic

New Member
Messages
77
Reaction score
0
Points
0
Thank for your help

why dont you download it, zip it, then upload it back?

I want to download it to save it in my computer for other uses.

I'm using slow internet, so it is difficult for me if I want to download a file more than 60 MB.

I will try using S_W_A_T's method .
Edit:
Mr S_W_A_T

It is OK now , thank you
 
Last edited:
Status
Not open for further replies.
Top