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!
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'); ?>
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?
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)
<?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)
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
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'); ?>
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help!!
-d images
<?php system('unzip CTG_product_photos.zip -d images'); ?>