diff --git a/HsDirectoryConfig.h.in b/HsDirectoryConfig.h.in
--- a/HsDirectoryConfig.h.in
+++ b/HsDirectoryConfig.h.in
@@ -48,9 +48,6 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define to 1 if you have the `utimensat' function. */
-#undef HAVE_UTIMENSAT
-
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
 
diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc
--- a/System/Directory/Internal/Windows.hsc
+++ b/System/Directory/Internal/Windows.hsc
@@ -113,7 +113,7 @@
       Win32.gENERIC_READ
       maxShareMode
       Nothing
-      Win32.oPEN_ALWAYS
+      Win32.oPEN_EXISTING
       (Win32.fILE_ATTRIBUTE_NORMAL .|. possiblyOverlapped)
       Nothing)
     Win32.closeHandle
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,12 @@
 Changelog for the [`directory`][1] package
 ==========================================
 
+## 1.3.8.5 (May 2024)
+
+  * Fix regression that causes copying of nonexistent files to create empty
+    files.
+    ([#177](https://github.com/haskell/directory/issues/177))
+
 ## 1.3.8.4 (Apr 2024)
 
   * Relax `time` version bounds to support 1.14.
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -3383,13 +3383,6 @@
 
 fi
 
-ac_fn_c_check_func "$LINENO" "utimensat" "ac_cv_func_utimensat"
-if test "x$ac_cv_func_utimensat" = xyes
-then :
-  printf "%s\n" "#define HAVE_UTIMENSAT 1" >>confdefs.h
-
-fi
-
 ac_fn_c_check_func "$LINENO" "CreateSymbolicLinkW" "ac_cv_func_CreateSymbolicLinkW"
 if test "x$ac_cv_func_CreateSymbolicLinkW" = xyes
 then :
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,6 @@
 AC_CHECK_HEADERS([fcntl.h limits.h sys/types.h sys/stat.h time.h])
 
 AC_CHECK_FUNCS([realpath])
-AC_CHECK_FUNCS([utimensat])
 AC_CHECK_FUNCS([CreateSymbolicLinkW])
 AC_CHECK_FUNCS([GetFinalPathNameByHandleW])
 
diff --git a/directory.cabal b/directory.cabal
--- a/directory.cabal
+++ b/directory.cabal
@@ -1,6 +1,6 @@
 cabal-version:  2.2
 name:           directory
-version:        1.3.8.4
+version:        1.3.8.5
 license:        BSD-3-Clause
 license-file:   LICENSE
 maintainer:     libraries@haskell.org
diff --git a/tests/CopyFile001.hs b/tests/CopyFile001.hs
--- a/tests/CopyFile001.hs
+++ b/tests/CopyFile001.hs
@@ -13,6 +13,13 @@
   copyFile (dir </> from) (dir </> to)
   T(expectEq) () [from, to] . List.sort =<< listDirectory dir
   T(expectEq) () contents =<< readFile (so (dir </> to))
+
+  -- Regression test for https://github.com/haskell/directory/issues/177
+  createDirectory "issue177"
+  T(expectIOErrorType) () isDoesNotExistError
+    (copyFile "issue177/nonexistentSrc" "issue177/dst")
+  T(expectEq) () [] =<< listDirectory "issue177"
+
   where
     contents = "This is the data\n"
     from     = "source"
