0

I am using exec "wrapper" for linux commands in PHP:

exec("unzip -oj tmp.zip -d tmp && rm tmp.zip");

Please tell me how can i convert spaces to underscores in filenames? Tnx,

user1192422
  • 131
  • 1
  • 2
  • 12
  • You can do it all simply with PHP. [Extract the files](http://stackoverflow.com/a/8889126/315306) and then rename those who contain a space in the name – Raffaele Nov 27 '12 at 13:15

1 Answers1

2

If you don'y mind using external utilities (as you're currently doing), you can use rename eg.

unzip -oj tmp.zip -d tmp && rename 's/\s/_/g' tmp/* && rm tmp.zip
Hasturkun
  • 35,395
  • 6
  • 71
  • 104