php - Hiding .DS_store from scandir() -


i having problems little script outputs file particular directory table output annoying .ds_store file running app on mac.

here script put - have tried various methods either stop script working altogether or has no effect.

<?php  echo '<table>';  $dir = 'archive/'; $files = scandir($dir, 0); for($i = 2; $i < count($files); $i++)     echo '<tr>           <td>' . $files[$i]. '</td>           <td><a href="' . $files[$i]. '" download><button>download</button></a>           <a href=""></a></td>           </tr>';  echo '</table>';  ?> 

you may want ignore files begin '.'

._whatever : these files created on volumes don't natively support hfs.

.trash : used store files thrown in trash haven't yet been deleted.

.spotlight-v100 : stores metadata indexes , indexing rules spotlight.

<?php  echo '<table>';  $dir = 'archive/'; $files = scandir($dir, 0); for($i = 2; $i < count($files); $i++)   if (preg_match("/^[^\.].*$/", $files[$i])) {     echo '<tr>       <td>' . $files[$i]. '</td>       <td><a href="' . $files[$i]. '" download><button>download</button></a>       <a href=""></a></td>       </tr>';   } echo '</table>'; ?> 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -