How to update the below action for each view bulk operations? It is for Drupal 7 I wants to delete the below folder every time only on each view bulk operations but currently it is getting deleted for each node selected in VBO. I am executing this action in rules module.
Please let men know how to run this only once for each VBO.
$pdfdir=&quot;/var/www/websites/test/sites/default/files/pdffolder&quot;;
$directory = escapeshellarg($pdfdir);
shell_exec(&quot;rm -rf $directory&quot;);

This is the code executing via Rules Module.
If you define a VBO event in rules that triggers on every node save, then it will happen once per node saved by VBO.  VBO takes all the selected items in a view and runs them through a batch process, performing operations per item.
So, you need to change the rule event to something else.
If the goal is to run the code once per time, here is one lazy way to do it:

Set the event to be &quot;page is viewed&quot;. (doing this from memory, actual event name is different)
Set a condition on the rule to be the path of the VBO page.
Use your execute PHP code as the action.

This will cause the code to execute whenever the VBO url is accessed.  This is not exactly what you asked for, but hopefully this gives you an idea of how to use events and conditions in rules to get what you want.