diff --git a/bin/record_expected_output b/bin/record_expected_output
index 8d88bdc..54b3d9a 100755
--- a/bin/record_expected_output
+++ b/bin/record_expected_output
@@ -5,9 +5,9 @@ if [ "local" = "$1" ]; then
   export PAGES_REPO_NWO=actions/jekyll-build-pages
   export JEKYLL_BUILD_REVISION=JEKYLL_BUILD_REVISION
 
-  for dir in $(ls test_projects)
+  for dir in test_projects/*
   do
-    bundle exec github-pages build --verbose -s test_projects/$dir -d test_projects/$dir/_expected
+    bundle exec github-pages build --verbose -s "test_projects/${dir}" -d "test_projects/${dir}/_expected"
   done
 else
   act -b -s GITHUB_TOKEN -j record-expected-output