We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    If you used ganeshXL’s code, you should be able to modify this regular expression to mean "if it starts with a ." to avoid the ., .. and .thumb... file entries.
      if (ereg('^\.{1,2}$',$fn)) continue;

    regex is not my strong point, but I know that can be done quite easily with the proper code. Maybe if you didn’t have the end-of-string symbol $ in the above expression? I believe as it is, it reads "begins and ends with 1 or 2 ."

    ^ is the "begins with" symbol, and trailing $ is the "ends with" symbol, while the .(1,2) means "one or two ."

    So ’^\.’ should mean "begins with ." (the . has to be escaped since it’s a regex symbol itself), and should prevent processing of anything that starts with a period.

    http://www.zend.com/zend/spotlight/code-gallery-wade5.php
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 29703
      • 217 Posts
      Quote from: ganeshXL at Nov 16, 2007, 11:28 AM

      A simple substr() works just as well:
      if(substr($fn, 0, 1) == ’.’) continue;



      Brilliant, works a charm!