Link to home
Start Free TrialLog in
Avatar of rlb1
rlb1

asked on

How do I adjust this unzip script to place contenets in specific folder?

Experts,
I have a simple script that works great on my server that unzips a file.  When the file is unzipped, it creates a new "folder" that is the same as the file name "CTG_product_photos".  I need the conents of the file to unzip in the "images" folder.  How do I fix this script to accomodate that?

<?php system('unzip CTG_product_photos.zip'); ?>

Thanks!

<?php system('unzip CTG_product_photos.zip'); ?>

Open in new window

Avatar of HainKurt
HainKurt
Flag of Canada image

http://linux.about.com/od/commands/l/blcmdl1_unzip.htm
-d images

<?php system('unzip CTG_product_photos.zip -d images'); ?>
 
Avatar of rlb1
rlb1

ASKER

HainKurt,
Thanks for your help!  That worked.  However, it is still creating a new directory, CTG_product_photos, within the images directory.  Is there a way to eliminate the creation of the new directory and just dump the images in the 'image' directory?

maybe this

<?php system('unzip CTG_product_photos.zip images -d images'); ?>

is there any sample that you can post here (a test zip file containing a few images)
Avatar of rlb1

ASKER

OK, I used the code <?php system('unzip CTG_product_photos.zip images -d images'); ?>
and the system returned "Archive: CTG_product_photos.zip"

The path to the image folder is: /www.myurl.net/web/content/cables/image

I need the file to dump directly into the 'image' folder without creating a secondary folder.  

Please note: I changed 'images' to 'image' before running script.

I appreciate your help!!
03170a.jpg
we need to know the inner structure of zip file... post a sample zip file, or open it with winzip (or some other tool and post screenshot of structure of zip file)

or lets try something else:

<?php system('unzip CTG_product_photos.zip -x images -d images'); ?>
<?php system('mv CTG_product_photos\images images'); ?>



ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rlb1

ASKER

Thank you for your help!!