Autorename extracted files from zip-archive
| From: | Merlin Morgenstern | Date: | Wed, 19 Jan 2011 14:06:27 +0000 |
| Subject: | Autorename extracted files from zip-archive | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-310862@lists.php.net to get a copy of this message | ||
Hello,
I am using shell_exec to uncompress zip files which works fine, but has one big problem. Whenever the zip-archive containes an already existing file name, it will overwrite the current one. I need the file to be extracted and autorenamed.
This is the code line:
$output = shell_exec('unzip -jo '.$filename.' -d '.$path);
Does anybody know a way on how to autorename existing files?
I thought about a workaround on extracting to a tmp folder and then moving to the proper directory while renaming the files if they already exists. Unfortunatelly I could not find a way to do this.
Thank you for any help on this.
Merlin