diff --git a/hpack.cabal b/hpack.cabal
--- a/hpack.cabal
+++ b/hpack.cabal
@@ -1,9 +1,9 @@
--- This file has been generated from package.yaml by hpack version 0.15.0.
+-- This file has been generated from package.yaml by hpack version 0.17.0.
 --
 -- see: https://github.com/sol/hpack
 
 name:           hpack
-version:        0.17.0
+version:        0.17.1
 synopsis:       An alternative format for Haskell packages
 description:    See README at <https://github.com/sol/hpack#readme>
 category:       Development
@@ -76,7 +76,7 @@
   main-is: Spec.hs
   hs-source-dirs:
       test
-    , src
+      src
   ghc-options: -Wall
   cpp-options: -DTEST
   build-depends:
diff --git a/src/Hpack/Config.hs b/src/Hpack/Config.hs
--- a/src/Hpack/Config.hs
+++ b/src/Hpack/Config.hs
@@ -792,7 +792,7 @@
   if exists
     then do
       src <- canonicalizePath (dir </> src_)
-      removeSetup src . toModules <$> getFilesRecursive src
+      removeSetup src . toModules <$> getModuleFilesRecursive src
     else return []
   where
     toModules :: [[FilePath]] -> [String]
diff --git a/src/Hpack/Util.hs b/src/Hpack/Util.hs
--- a/src/Hpack/Util.hs
+++ b/src/Hpack/Util.hs
@@ -8,7 +8,7 @@
 , LdOption
 , parseMain
 , toModule
-, getFilesRecursive
+, getModuleFilesRecursive
 , tryReadFile
 , expandGlobs
 , sort
@@ -84,13 +84,13 @@
     stripSuffix :: String -> String -> Maybe String
     stripSuffix suffix x = reverse <$> stripPrefix (reverse suffix) (reverse x)
 
-getFilesRecursive :: FilePath -> IO [[String]]
-getFilesRecursive baseDir = go []
+getModuleFilesRecursive :: FilePath -> IO [[String]]
+getModuleFilesRecursive baseDir = go []
   where
     go :: [FilePath] -> IO [[FilePath]]
     go dir = do
       c <- map ((dir ++) . return) . filter (`notElem` [".", ".."]) <$> getDirectoryContents (pathTo dir)
-      subdirsFiles  <- filterM (doesDirectoryExist . pathTo) c >>= mapM go
+      subdirsFiles  <- filterM (doesDirectoryExist . pathTo) c >>= mapM go . filter isModule
       files <- filterM (doesFileExist . pathTo) c
       return (files ++ concat subdirsFiles)
       where
diff --git a/test/Hpack/UtilSpec.hs b/test/Hpack/UtilSpec.hs
--- a/test/Hpack/UtilSpec.hs
+++ b/test/Hpack/UtilSpec.hs
@@ -49,18 +49,27 @@
     it "rejects invalid module names" $ do
       toModule ["resources", "hello.hs"] `shouldBe` Nothing
 
-  describe "getFilesRecursive" $ do
-    it "gets all files from given directory and all its subdirectories" $ do
-      inTempDirectoryNamed "test" $ do
+  describe "getModuleFilesRecursive" $ do
+    it "gets all files from given directory" $ do
+      inTempDirectory $ do
         touch "foo/bar"
         touch "foo/baz"
-        touch "foo/foobar/baz"
-        actual <- getFilesRecursive "foo"
+        actual <- getModuleFilesRecursive "foo"
         actual `shouldMatchList` [
             ["bar"]
           , ["baz"]
-          , ["foobar", "baz"]
           ]
+
+    it "descends into subdirectories" $ do
+      inTempDirectory $ do
+        touch "foo/Bar/baz"
+        getModuleFilesRecursive "foo" `shouldReturn` [["Bar", "baz"]]
+
+    context "when a subdirectory is not a valid module name" $ do
+      it "does not descend" $ do
+        inTempDirectory $ do
+          touch "foo/bar/baz"
+          getModuleFilesRecursive "foo" `shouldReturn` empty
 
   describe "List" $ do
     let invalid = [aesonQQ|{
