FTP and remote unzip


#1

Hi,
I have to transfer something like 50.000 files in a folders and many subfolders. The structure is something like:

data
data\1
data\2
data\2\something
data\3

and so on.

I made a zip files (using winzip). Obviously I made the zip with folers info…

I have uploaded this file in \mydomain.com\images

Wich is the shell command to unzip all those files under this folder and have:

images\data
images\data\1
images\data\2
images\data\2\something
images\data\3

and so on?

Can someone write exactly it for me (maybe also with the nice command before the unzip command because I’m on a shared host and I want to be sure not to create problems to others…)?

Thank everyone :slight_smile:


#2

I’ll try as soon as the upload ends. BTW what “&” means?


#3

& would make the operation a background proccess on the server, i.e. you wouldn’t be flooded by it’s output.


#4

so why not just:
unzip example.zip
?


#5

You could do that and it’d work just fine, nice is just a way of allowing you to set a proccess to be more CPU intensive or less CPU intensive.


#6

I tried, but I get this error:

unzip: cannot find or open media.zip, media.zip.zip or media.zip.ZIP.

I am in the folder where media.zip is… I also tried with the full path… with /media.zip, with ./media.zip… every time the same error.

Maybe is because the zip file is > 2 GB? And if thi is the problem how can I do? Thanks :slight_smile:


#7

If you’re in the same directory, just the file name should do the trick (case-sensitive).

Are you sure there aren’t any spaces in there? " file.zip" isn’t the same as “file.zip” or “fil e.zip” etc…


:stuck_out_tongue: Save $96 at Dreamhost with the 96DOLLARSOFF promo code.


#8

The file name is media.zip, no spaces or other strange things… I edited my last message… maybe this should cause the error?


#9

when you’re in the correct directory, type
ls
and the copy and past the file name just to be absolutely sure you’re getting the correct one.


#10

Done, but no success :frowning: The filename is media.zip
I tried with a smaller file (60 MB) and I had no problem.
By the way… in the case the zip file is corrupted is the error message the same?


#11

From the unzip faq (http://www.info-zip.org/FAQ.html#corruption):

"In practice, the real limit may be 2 GB on many systems, due to UnZip’s use of the fseek() function to jump around within an archive. Because’s fseek’s offset argument is usually a signed long integer, on 32-bit systems UnZip will not find any file that is more than 2 GB from the beginning of the archive. And on 64-bit systems, UnZip won’t find any file that’s more than 4 GB from the beginning (since the zipfile format can only store offsets that big). So the last file in the archive can potentially be arbitrarily large (in theory, anyway–we haven’t tested this), but the combined total of all the rest must be less than 2 GB or 4 GB, respectively. "

So I think the error is due to the file that is > 2GB. If my supposition is right… how can I solve (other than make smaller archives ^_^)


#12

You could tar/gunzip archive instead. Check out http://www.gzip.org for more info and of course you are welcomed to ask more questions here as well.


#13

Thanks, I’ll search. But I already saw on the gzip site:

“Can gunzip extract a .zip archive?
No. Use unzip instead.”

So maybe I have to make a different archive and upload it again to use gzip? In the meantime I better look at gzip :slight_smile:


#14

I think I solved…
I’m pretty sure that the problem was related to the .zip file’s dimension. I used the jar utility that come with java to extract files (jar -xvf filename.zip) and right now the extraction is going on.

I hope this can be useful to others.


#15

If you have SSH access definitely do that. Otherwise you may have a built-in cPanel function or check with ZipDeploy