ShopMAster Posted September 11, 2007 Share Posted September 11, 2007 I'm fairly new to PHP, but I was wondering if there is a way to execute Linux commands via a PHP Script. Here's my delima. I want to run a cron job that runs a php script that renames all the files in a directory and then move those files to a different directory. Quote Link to comment https://forums.phpfreaks.com/topic/68834-php-and-linux-commands/ Share on other sites More sharing options...
micah1701 Posted September 11, 2007 Share Posted September 11, 2007 look into the exec() functions http://us.php.net/manual/en/function.exec.php Quote Link to comment https://forums.phpfreaks.com/topic/68834-php-and-linux-commands/#findComment-345993 Share on other sites More sharing options...
ShopMAster Posted September 11, 2007 Author Share Posted September 11, 2007 Thanks. Looks like I'm going to have to look at getting a Freelancer for this. Quote Link to comment https://forums.phpfreaks.com/topic/68834-php-and-linux-commands/#findComment-346001 Share on other sites More sharing options...
effigy Posted September 11, 2007 Share Posted September 11, 2007 If you're using cron, you might as well use a shell script for this. It will be simpler and better suited for the task. Also, there's no need to rename the files then move them--this can all be done in one step. If you're dealing with logs, you might want to check out cronolog. Quote Link to comment https://forums.phpfreaks.com/topic/68834-php-and-linux-commands/#findComment-346017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.