For example, to copy file from one directory to another we can execute the linux find & cp command directly into a PHP script like,
- Code: Select all
<?php
exec("find E:/xampp/htdocs/site.com/image/ -name test.png -exec cp {} E:/xampp/htdocs/site.com/thumb/\;");
?>
On the other hand to copy file through windows command prompt we use,
- Code: Select all
E:\xampp\htdocs\site.com\image> copy test.png E:\xampp\htdocs\site.com\thumb
but the above command isn't working in script level execution when it is executed as,
- Code: Select all
<?php
exec("E:\xampp\htdocs\site.com\image> copy test.png E:\xampp\htdocs\site.com\thumb");
?>
How to execute windows command in php script level in this case?
exec is enabled on my xampp.
Thanks,