-2

I have created zip files using shell_exec function. I am trying to rename files from created zip using shell_exec function. Any idea about it?

Digambar
  • 9
  • 6
  • From the documentation: `shell_exec — Execute command via shell and return the complete output as a string`... just use the server to rename it. Linux and Windows rename commands will differ – Bonatti Dec 22 '15 at 10:31
  • 4
    Possible duplicate of [Rename multiple files shell](http://stackoverflow.com/questions/6911301/rename-multiple-files-shell) – Bonatti Dec 22 '15 at 10:32

3 Answers3

0

Why don't using php built in rename() function?

http://php.net/manual/en/function.rename.php

nira
  • 31
  • 5
0

I have solved problem using following command shell_exec('printf "@ old_file_name.pdf\n@=new_file_name.pdf\n" | zipnote -w '.$zip_name);

Digambar
  • 9
  • 6
0

You can do it like this.

Create zip file: shell_exec('zip -j myzip.zip old_file_name.pdf');

Rename created zip file: shell_exec('printf "@ old_file_name.pdf\n@=new_file_name.pdf\n" | zipnote -w '.myzip.zip);

Digambar
  • 9
  • 6