diff --git a/lib/analysis-paths.js b/lib/analysis-paths.js
index 23481b192..acc9fd98a 100644
--- a/lib/analysis-paths.js
+++ b/lib/analysis-paths.js
@@ -8,19 +8,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const core = __importStar(require("@actions/core"));
+function isInterpretedLanguage(language) {
+    return language === 'javascript' || language === 'python';
+}
 function includeAndExcludeAnalysisPaths(config, languages) {
+    // The 'LGTM_INDEX_INCLUDE' and 'LGTM_INDEX_EXCLUDE' environment variables
+    // control which files/directories are traversed when scanning.
+    // This allows including files that otherwise would not be scanned, or
+    // excluding and not traversing entire file subtrees.
+    // It does not understand double-globs because that would require it to
+    // traverse the entire file tree to determine which files are matched.
     if (config.paths.length !== 0) {
         core.exportVariable('LGTM_INDEX_INCLUDE', config.paths.join('\n'));
     }
     if (config.pathsIgnore.length !== 0) {
         core.exportVariable('LGTM_INDEX_EXCLUDE', config.pathsIgnore.join('\n'));
     }
-    function isInterpretedLanguage(language) {
-        return language === 'javascript' || language === 'python';
+    // The 'LGTM_INDEX_FILTERS' environment variable controls which files are
+    // extracted or ignored. It does not control which directories are traversed.
+    // This does understand the double-glob syntax.
+    const filters = [];
+    filters.push(...config.paths.map(p => 'include:' + p));
+    filters.push(...config.pathsIgnore.map(p => 'exclude:' + p));
+    if (filters.length !== 0) {
+        core.exportVariable('LGTM_INDEX_FILTERS', filters.join('\n'));
     }
-    // Index include/exclude only work in javascript and python
-    // If some other language is detected/configured show a warning
-    if ((config.paths.length !== 0 || config.pathsIgnore.length !== 0) && !languages.every(isInterpretedLanguage)) {
+    // Index include/exclude/filters only work in javascript and python.
+    // If any other languages are detected/configured then show a warning.
+    if ((config.paths.length !== 0 ||
+        config.pathsIgnore.length !== 0 ||
+        filters.length !== 0) &&
+        !languages.every(isInterpretedLanguage)) {
         core.warning('The "paths"/"paths-ignore" fields of the config only have effect for Javascript and Python');
     }
 }
diff --git a/lib/analysis-paths.js.map b/lib/analysis-paths.js.map
index e409927c2..af3103b65 100644
--- a/lib/analysis-paths.js.map
+++ b/lib/analysis-paths.js.map
@@ -1 +1 @@
-{"version":3,"file":"analysis-paths.js","sourceRoot":"","sources":["../src/analysis-paths.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAItC,SAAgB,8BAA8B,CAAC,MAA0B,EAAE,SAAmB;IAC5F,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACpE;IAED,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,IAAI,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KAC1E;IAED,SAAS,qBAAqB,CAAC,QAAQ;QACrC,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,QAAQ,CAAC;IAC5D,CAAC;IAED,2DAA2D;IAC3D,+DAA+D;IAC/D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE;QAC7G,IAAI,CAAC,OAAO,CAAC,4FAA4F,CAAC,CAAC;KAC5G;AACH,CAAC;AAlBD,wEAkBC"}
\ No newline at end of file
+{"version":3,"file":"analysis-paths.js","sourceRoot":"","sources":["../src/analysis-paths.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AAItC,SAAS,qBAAqB,CAAC,QAAQ;IACrC,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,QAAQ,CAAC;AAC5D,CAAC;AAED,SAAgB,8BAA8B,CAAC,MAA0B,EAAE,SA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,CAAC;AAhCD,wEAgCC"}
\ No newline at end of file
diff --git a/lib/analysis-paths.test.js b/lib/analysis-paths.test.js
index 54848dac5..67646de45 100644
--- a/lib/analysis-paths.test.js
+++ b/lib/analysis-paths.test.js
@@ -20,6 +20,7 @@ ava_1.default("emptyPaths", async (t) => {
     analysisPaths.includeAndExcludeAnalysisPaths(config, []);
     t.is(process.env['LGTM_INDEX_INCLUDE'], undefined);
     t.is(process.env['LGTM_INDEX_EXCLUDE'], undefined);
+    t.is(process.env['LGTM_INDEX_FILTERS'], undefined);
 });
 ava_1.default("nonEmptyPaths", async (t) => {
     let config = new configUtils.Config();
@@ -28,5 +29,6 @@ ava_1.default("nonEmptyPaths", async (t) => {
     analysisPaths.includeAndExcludeAnalysisPaths(config, []);
     t.is(process.env['LGTM_INDEX_INCLUDE'], 'path1\npath2');
     t.is(process.env['LGTM_INDEX_EXCLUDE'], 'path3\npath4');
+    t.is(process.env['LGTM_INDEX_FILTERS'], 'include:path1\ninclude:path2\nexclude:path3\nexclude:path4');
 });
 //# sourceMappingURL=analysis-paths.test.js.map
\ No newline at end of file
diff --git a/lib/analysis-paths.test.js.map b/lib/analysis-paths.test.js.map
index 5a9c6a01b..487a8d04a 100644
--- a/lib/analysis-paths.test.js.map
+++ b/lib/analysis-paths.test.js.map
@@ -1 +1 @@
-{"version":3,"file":"analysis-paths.test.js","sourceRoot":"","sources":["../src/analysis-paths.test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAuB;AAEvB,gEAAkD;AAClD,4DAA8C;AAC9C,mDAAmD;AAEnD,kCAAkB,CAAC,aAAI,CAAC,CAAC;AAEzB,aAAI,CAAC,YAAY,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAC3B,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,aAAa,CAAC,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC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AAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,eAAe,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAC9B,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1C,aAAa,CAAC,8BAA8B,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,4DAA4D,CAAC,CAAC;AACxG,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/src/analysis-paths.test.ts b/src/analysis-paths.test.ts
index dce62f617..aec2eb183 100644
--- a/src/analysis-paths.test.ts
+++ b/src/analysis-paths.test.ts
@@ -11,6 +11,7 @@ test("emptyPaths", async t => {
   analysisPaths.includeAndExcludeAnalysisPaths(config, []);
   t.is(process.env['LGTM_INDEX_INCLUDE'], undefined);
   t.is(process.env['LGTM_INDEX_EXCLUDE'], undefined);
+  t.is(process.env['LGTM_INDEX_FILTERS'], undefined);
 });
 
 test("nonEmptyPaths", async t => {
@@ -20,4 +21,5 @@ test("nonEmptyPaths", async t => {
   analysisPaths.includeAndExcludeAnalysisPaths(config, []);
   t.is(process.env['LGTM_INDEX_INCLUDE'], 'path1\npath2');
   t.is(process.env['LGTM_INDEX_EXCLUDE'], 'path3\npath4');
+  t.is(process.env['LGTM_INDEX_FILTERS'], 'include:path1\ninclude:path2\nexclude:path3\nexclude:path4');
 });
diff --git a/src/analysis-paths.ts b/src/analysis-paths.ts
index 6a88da05f..3d1e56dc7 100644
--- a/src/analysis-paths.ts
+++ b/src/analysis-paths.ts
@@ -2,22 +2,40 @@ import * as core from '@actions/core';
 
 import * as configUtils from './config-utils';
 
+function isInterpretedLanguage(language): boolean {
+  return language === 'javascript' || language === 'python';
+}
+
 export function includeAndExcludeAnalysisPaths(config: configUtils.Config, languages: string[]) {
+  // The 'LGTM_INDEX_INCLUDE' and 'LGTM_INDEX_EXCLUDE' environment variables
+  // control which files/directories are traversed when scanning.
+  // This allows including files that otherwise would not be scanned, or
+  // excluding and not traversing entire file subtrees.
+  // It does not understand double-globs because that would require it to
+  // traverse the entire file tree to determine which files are matched.
   if (config.paths.length !== 0) {
     core.exportVariable('LGTM_INDEX_INCLUDE', config.paths.join('\n'));
   }
-
   if (config.pathsIgnore.length !== 0) {
     core.exportVariable('LGTM_INDEX_EXCLUDE', config.pathsIgnore.join('\n'));
   }
 
-  function isInterpretedLanguage(language): boolean {
-    return language === 'javascript' || language === 'python';
+  // The 'LGTM_INDEX_FILTERS' environment variable controls which files are
+  // extracted or ignored. It does not control which directories are traversed.
+  // This does understand the double-glob syntax.
+  const filters: string[] = [];
+  filters.push(...config.paths.map(p => 'include:' + p));
+  filters.push(...config.pathsIgnore.map(p => 'exclude:' + p));
+  if (filters.length !== 0) {
+    core.exportVariable('LGTM_INDEX_FILTERS', filters.join('\n'));
   }
 
-  // Index include/exclude only work in javascript and python
-  // If some other language is detected/configured show a warning
-  if ((config.paths.length !== 0 || config.pathsIgnore.length !== 0) && !languages.every(isInterpretedLanguage)) {
+  // Index include/exclude/filters only work in javascript and python.
+  // If any other languages are detected/configured then show a warning.
+  if ((config.paths.length !== 0 ||
+        config.pathsIgnore.length !== 0 ||
+        filters.length !== 0) &&
+      !languages.every(isInterpretedLanguage)) {
     core.warning('The "paths"/"paths-ignore" fields of the config only have effect for Javascript and Python');
   }
 }