10

I'm having a PHP project that for some reason (not my initiative) has some backup files like "somefile - backup.php". How do I exclude "%backup%.php" from indexing?

Konstantin Bodnia
  • 1,372
  • 3
  • 20
  • 43

2 Answers2

32

Settings/Preferences | Editor | File Types | Ignore files and folders field on the bottom -- add *-backup.php pattern (or whatever pattern you need).

PLEASE NOTE: this affects all projects as it is an IDE-wide setting.

enter image description here


Alternatively (have not tried myself, but should work):

Settings/Preferences | Editor | File Types | Recognized File Types | Text

Add *-backup.php pattern there.

This will also affect all projects .. but instead of excluding it will treat them as plain text files, so no indexing/code completion/syntax highlighting/etc while still having such files in the Project View tree (so you can edit/delete/upload/etc them if necessary).

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • The second alternative is perfect if you want to avoid using scopes. Thank you. For Symfony2 users add `app*.php` (lowercase) and `classes.php` to the file patterns that should be recognized as text files. As it doesn't seem to allow regular expressions this will also un-index your `app.php` and `app_dev.php` but as they are normally edited just once I think that drawback is worth it. – flu Oct 28 '13 at 09:46
  • @MohammedSaqibRajput Mark it as Excluded. – LazyOne May 20 '15 at 08:41
  • @LazyOne Thanx. Right click the directory -> Mark Directory As -> Excluded. – Mohammed Saqib Rajput May 20 '15 at 10:54
  • The first setting only affects version control and has moved to `Settings | Version Control | Ignored Files` or `Settings | Version Control | Ignore Files Support` and the second setting is now under `Settings | Editor | File Types`. – TwoD Dec 05 '16 at 09:53
  • @TwoD The settings did not move anywhere under Version Control -- it's still there. Just new settings path since v9 -- `Settings/Preferences | Editor | File Types`. Version Control settings is different/separate stuff. – LazyOne Dec 05 '16 at 10:23
  • 1
    @LazyOne v9? I'm using PhpStorm 2016.3 and those settings are nowhere to be seen. There's also no `Preferences`, just `Settings` and `Default Settings` under `File`. – TwoD Dec 05 '16 at 11:19
  • @TwoD **1)** `Preferences` is for Mac users ... which do not have `File | Settings` .. because it's `PhpStorm | Preferences` on Mac; therefore `Settings/Preferences` is whatever you have got there **2)** It is there -- 100% -- http://postimg.org/image/stox8ep55/ ; https://www.jetbrains.com/help/phpstorm/2016.3/file-types.html – LazyOne Dec 05 '16 at 11:31
  • @LazyOne Ok, got that. Never mind about the missing settings, I thought you meant the original location was still there. – TwoD Dec 05 '16 at 12:38
5

"Settings > File Types > Ignore file and folders" and add the path of the folder.

Example: *.lib;client/build;

This worked for me to ignore a folder.

TylerH
  • 20,799
  • 66
  • 75
  • 101
otaviodecampos
  • 1,586
  • 16
  • 10